The Basics Of Web Forms
A web form is required to receive data from the visitors. This data can either be a username and password or a complete address. Whatever it will be, the basic principles will be the same.
Tags
Form tags require a lot of memorizing on the part of the web designer. The tags vary and are dependent on the kind of input boxes that are required in the form.
An example for a form tag is:
<form method="post" action="action.php"></form>
These tags tell the browser where to send the data that is entered on the form. The file given under the action has to be a script that would take some action on the data. This action could be anything such as entering it onto a database. For submission of data to an email address, the command under action tag would be 'mailto: name@emailaddress.com'.
After the action has been defined, you need to add input tags. There are many different types of input tags which are mentioned under the 'type' property, such as:
<input type="checkbox" name="example">one</input>
The name property is used to give a name to the checkbox. The text written between the open and close tags appears in front of the checkbox.
Besides this, the other input types are:
* Text : It displays a text box.
* Button : It displays a click able button.
* Radio : It shows radio buttons that are used to chose one option from a set of options.
* File : This box allows the visitors to upload a file to your site.
* Reset : It is a button that removes everything that a user has entered in the form in order to fill it again.
* Submit : It is a special button that helps in sending the result of the form.
Web Forms and CSS
To make the web page look attractive, some styling needs to be added to the form which use CSS. The use of CSS, addition of background color, changed fonts, added or removed borders, and the like prove to be beneficial in this regard.
Validating Input
After something has been typed in a form, it needs to be validated. For instance, when an email address is entered, there has to be an @ in it. When creation of an username, it is necessary to check out if it has been taken before.
Data can be validated in either of the two ways, that is, from the server-side or the client-side. Client-side validation is done with the use of Javascript. This is done for the sake of the user so that they do not submit a wrong form. Server-side validation is done with the use of languages such as PHP. This is done just before the data gets transferred onto the database. The user gets an error page after submission of the form asking him to re-enter relevant information.
However, everything should not be left entirely on Javascript, as some visitors have Java turned off in their browsers.






















