Basic HTML Forms

Forms Are a Bit Different

HTML Forms can be a little difficult for beginners to understand. You can build them on your PC, but to make them functional for testing purposes, you must be running on a web server.

You can do this in two ways.

1...Upload your form to a free or paid web host. Work out the bugs by making changes and then uploading again to retest, retest and retest again.

 

2...Set up a localhost server on your computer. Test them on your PC and work out the kinks before you upload them.

This process can be fairly simple if you use our recommended installation package (IndigoAmpp).

 

See: My IndigoAmpp Tutorial

What Are Forms?

Forms are interactive devices used to gather information from your users.

They can incorporate the use of text boxes to gather typed information or provide choices of data using, check boxes selection boxes and even radio buttons

To be able to use forms, the server on which your site is located must provide CGI capabilities. You can forget that if you've settled on using FREE web hosting.

CGI is a system of files that process data received from forms.

The Form Tags

Form <form></form>

Attributes

Method
There are two methods used by browsers to send information to a server. They are Post and Get.

These are specified in code as:
<form method="POST">
<form method="GET">

Action Tells the browser what CGI program to use and where it is located.

A form tag with both attributes would be coded as:
<form method="POST" action="parse-form.php">

In this example the code tells the browser to use the post method, and to use the PHP script, parse-form.php, located on the server.

Input <input></input>

Attributes
Two required attributes are Type and Name.
Optional: required (cuts down on the empty forms you receive)
Example: <input type="text" required="required">
Type specifies the device used.
Options:

Name A name assigned to the information or data collected by the input device. The server receives information in name/value pairs.

Value is the information chosen or entered by the user.

Name identifies that information. (Don't go on until this concept sinks in.)

Extend Your Knowledge

We recently revamped our PHP/MySQL section. Learn how to set up the Apache server on your PC, build a MySQL database and manipulate the records using PHP scripts.

Check it Out!