Creating a form is quite simple. The trickery arrives when it's time to process the information gathered by the form. Fortunately, busy software engineers have created programs for that as well.
Forms can have three types of tags, all used to collect input from the user.
Combine these three formats and you can gather information in a variety of ways.
You need an opening and ending tag to create a form, just as you would with tables or frames. Begin with <FORM>. Within this first tag you will include attributes that define what script the form will use and how it will send the collected data to the server. The term ACTION is assigned a URL that will accept the information and the term METHOD defines how the information will be sent to the script. The most common method is POST, which sends the information separately from the URL to the script.
Here is an example of a form tag:
<FORM METHOD="POST" ACTION="/cgi-bin/script">
You now need to define the parts of your form. Each of the three form input types have their own attributes.
Format Your Form
As with any other text on your website, you will have to format your forms to make them look good. You can use any HTML that you would with regular text, but there are a few caveats. You cannot format the text used inside of text boxes.
You can use the <PRE> tag to organize your forms so that the boxes line up. This can cause some problems however as not all fonts have equal sized characters. So what looks good for you, may not appear correctly in different browsers and systems.
The best organization is usually achieved when you place your forms inside a table. In this case, the table is placed within the beginning and ending FORM tags and each input field is placed within the table tags as needed.
Some tips for form layout:
Gather the Data
CGI, or Common Gateway Interface, was created to allow HTML documents to communicate with other applications. It provides a common environment and a set of protocols for applications to use when working with the Web server. Let's say you are searching for something on the Internet. Once you enter your query, the browser asks the server to run the correct CGI script. The script communicates with the database archive and finds information requested by the form. This information is then sent the server which feeds it back to the browser.
CGI scripting is pretty advanced. If you feel like conquering CGI scripting, you will need to talk to your ISP and find out if you have permission, as not all ISPs will let you have access to the CGI-bin. Then visit Devhead or Webmonkey for some tips and tutorials.
If you'd rather leave the scripting to someone else, you could download some shareware. Silicon Ali tried one called WebForms, available from the ZDNet Software Library. Not only will it create a form for you, but it allows you to choose whether you would like to receive the form information via a CGI response, or have it mailed to your email address.
Once the data is collected, you can enter it into a database program such as FileMaker.
|Home||Information Page||HTML Lessons||Java Script Lessons|