Home
Username:
Password:
Web Publishing and Publicizing Tutorials

Web Concepts and Technologies / Forms

Subtitles of the Movie

A form is something that you can add to a web page to allow the user to provide information to you. Most of the functionality of a web page is devoted to providing information to the user. But occasionally you might need information from the user, you might need their name and address, you might need their credit card details, you might need their feedback, you might need anything, and you can get the user to fill in that information in little boxes on your page, and then it sends that information to your web server. Now on your web server there must be some program in place that will actually take that information and do something with it. Something like a CGI bin program, anyway let’s have a look at all this. So a from is an area of an HTML page, it's a small part of the HTML page that can be used to obtain input from the person viewing the page, typically a text input. Although it doesn't have to be, it can be tick boxes or option choices and so forth. This enables obviously a two-way flow of information. You can send the information back to the web server. These forms use CGI scripts to process the information entered by the user. The CGI scripts are running on the server and they’re activated when the user submits the information in the form. Let’s have a look at first a very simple example of a form. Here is a simple classic feed back form. This form is actually on one of my web pages. I made this for my world trip, when I went traveling around the world in 1999. It is part of this particular web page, this page is called the ‘contact us’ page and there are a few things on it our email addresses and various other things and a feed back form. Now the form kind of starts around about here and ends around about here. That is the form region on the page, so you typically fill in the various details, click the send button. What happens when you click the send button? Well in order to find that out, you would have to look at the source code of the HTML, which as you recall is in view source. So let’s have a look at that now, here is the source code of that particular web page and the interesting part of the page is down at the bottom here where it starts with form and goes all the way to the end of the form here, that slash form means the end of the form, So these are all the things on the form, your name, your email address, your comments and then a submit button and a clear button. It still doesn't tell us what happens when someone clicks on the submit button. Let’s find out. Here, this is a reference to a file, here is the file, feedback.cgi that is a script that is running in that particular sub folder of that particular machine. So when the send button down here is clicked on, this action here is taken. The browser will contact the server, this particular server in this case and ask it to run this program and it will run this program and it will feed it the following information. It will feed it this particular name information, the email information and the comment information will all been sent to the CGI bin script. I can show you the CGI bin script too, I’ve got that here, here’s the CGI bin script. It's called feedback.cgi and it's written in the language of Perl. You can see that by looking in the very first line of the script, it usually tells you what language it’s written in. It is a Unix notation stating that this program is to be executed using a Perl program and this particular Perl script sends an email to something called ‘send email response’, which is down here some where. I won’t go into it. I'll have to teach you a little bit about Perl and I’m not going to do that. But it sends, it basically sends an email to that particular email address without that back slash in there. So let’s fill it out, let’s see what happens if we actually fill it out, the form that is. So it's from Fred and its fred@fred.com ‘You made a really good website’. Okay, that’s going to be the feedback. Now that has sent an email to me which I should receive shortly and it has taken you to this particular page which says ‘thanks very much for the feed back’. Let’s have a look now at another example of a form. I’m going to take you to the Australian white pages website. Now this particular web page has got three forms on it. One over here, which is the search page, the search form, which is you enter all of this information or perhaps just some of it and then you click on the search button, which then contacts the white pages web server and finds the information that you require, it’s got another form up here which is used to navigate you to a different part of the website and it’s got another one here to help you find a job which will take you to the monster.com.au job search web page. So it will actually probably contact a completely different server. I chose this particular website because there are 3 different forms on the one page. If you examine the HTML code of this particular page, you will find references to the other server functionality that processes these forms. In the next module we’ll have a look at Java.

Tutorial Information

Course: Web Publishing and Publicizing
Author: Mark Virtue
SKU: 33298
ISBN: 1930519729
Release Date: 2002-03-11
Duration: 6 hrs / 61 lessons
Work Files: Yes
Captions: For Online University members only
Compatibility: Vista/XP/2000, OS X, Linux
QuickTime 7, Flash 8

VTC Sign up & Benefits

  • Unlimited Access
  • 98,729 Video Tutorials (23,265 free)
  • Video Available as Flash or QuickTime
  • Over 1026 Courses
  • $30 for One Month Access
  • Multi-User Discounts Available