Basic HTML Forms
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 your 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).
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:
- button
- checkbox
- radio
- reset
- text
- hidden
- submit
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.
Free Tools We Recommend
- Free Ebook How to Code in HTML5 and CSS3
- "How to Code in HTML5 and CSS3" is a free e-book about making websites in HTML5 and CSS for absolute beginners. It doesn't require any experience in IT to start....
- Free Logo Generator Turbologo.com
- If you are building a website for business you need to begin thinking about creating a brand identity. An unforgettable logo could be just the start you need. You can create it free at Turbologo.com. They also provide generators for business cards and letterheads.
- FREE HTML Editor (Windows): NoteTab Light
- All the features of a commercial HTML editor.
- FREE Apache Server (Windows): IndigoAmpp
- Set up a real time server environment right on your PC. Test forms and scripts before uploading to your web space.
- Linux Users
- If like us, you've left the insane world of Microsoft Windows for the even worse experience of Linux, we recommend the BlueFish HTML editor. You'll find it in your software repository. It does have some QUIRKS, but it's FREE.
- For image resizing we've found the easiest Linux tool to be Krita.
Have you tried our Free Mobile Ready website template kit? Download Template #402 - 6 Page Kit