Using Form Tags

To start out, you want to set up your <FORM> environment to build a form within a Web page. It's okay to add a form to an existing HTML document or build a separate one just to contain your form. I recommend that you add shorter forms, half a screen or less, to an existing document. Create a new file if your form is larger than half a screen.

Setting the <FORM> Environment

The two key attributes within the <FORM> tag are METHOD and ACTION. Together, these attributes control how information is sent to the Web server and which input-handling program receives the form's content.
Note: In JavaScript, you may not need to use METHOD and ACTION if you do not want information sent to the Web server.

There's no rhythm to Method

The METHOD indicates how the information is sent to the server when the form is submitted. METHOD can take one of two possible values: POST or GET.

Of these two methods, I prefer POST because it causes a form's contents to be passed one element at a time. GET, on the other hand, joins all the field names and their associated values into one long string. Because UNIX systems have a limit on how long a single string can be (255 characters), it's not hard to imagine that some of the information might get lost when it's contents are condensed.

Lights, camera...ACTION

ACTION supplies the URL for the CGI script or other input-handling program on the server that receives a form's input. The URL can be a full specification (absolute) or simply a relative reference. Either way, you need to make sure the URL points at the right program, in the right location, to do the job that's expected.

Let's make an assumption...

Because GeoCities has provided the input handling program for us, we don't have to worry about writing such an advanced program ourselves. So, we will follow two conventions for all the syntax in this lesson.

  • In every <FORM> tag, METHOD="POST".

  • For every ACTION, URL="/cgi-bin/homestead/mail.pl?membername">, where "membername" is your GeoCities member name, the name you have to use to enter the File Manager or other programs at GeoCities. You can then develop any form that you'd like to use, and get the results sent to your mailbox. The results will be sent to the email address that you have on file in your Yahoo Profile.

  • In other words, Every form will start with: <FORM METHOD="POST" ACTION="/cgi-bin/homestead/mail.pl?Your membername">

 

[Go Back one page]   [Next page]