X hits on this document

PDF document

HTML Beginner's Guide - page 12 / 16





12 / 16


Forms can be used to send data across the web and are often used as contact forms to convert information inputted by a user into an email, such as the one used on this website.

On their own, forms are useless. They need to be hooked up to a program that will process the data inputted by the user. These take all manner of guises and are outside of the remit of this website. If you use an internet service provider to host your HTML, they will be able to help you with this and will probably have clear and simple instructions on how, for example, to make a form-to-email form work.

The tags used in the actual HTML of forms are form, input, textarea, select and option.

form defines the form and within this tag, there is one required action attribute which tells the form where its contents will be sent to when it is submitted.

The optional method attribute tells the form how the data in it is going to be sent and it can have the value get (which is default) or post. This is commonly used, and often set to post which hides the information (get latches the information onto the URL).

So a form element will look something like this:

<form action="processingscript.php" method="post"> </form>

The input tag is the daddy of the form world. It can take ten forms, outlined below:






<input type="text" /> is a standard textbox. This can also have a value attribute, which sets the text in the textbox. <input type="password" /> is the same as the textbox, but will display asterisks instead of the actual characters that the user types. <input type="checkbox" /> is a checkbox, which can be toggled on and off by the user. This can also have a checked attribute, which would be used in the format <input type="checkbox" checked="checked" />. <input type="radio" /> is similar to a checkbox, but the user can only select one radio button in a group. This can also have a checked attribute, used in the same way as the checkbox. <input type="file" /> is an area that shows the files on your computer, like you see when you open or save a document in most programs.

Document info
Document views22
Page views22
Page last viewedMon Oct 24 05:47:33 UTC 2016