X hits on this document

PDF document

HTML Beginner's Guide - page 13 / 16





13 / 16


<input type="submit" /> is a button that when selected will submit the form. You can control the text that appears on the submit button (as you can with button and reset types - see below) with the value attribute, for

example <input type="submit" value="Ooo. Look. Text on a button. Wow" />.





<input type="image" /> is an image that when selected will submit the form. This also requires a src attribute, like the img tag. <input type="button" /> is a button that will not do anything without extra code added. <input type="reset" /> is a button that when selected will reset the form fields. <input type="hidden" /> is a field that will not be displayed and is used to pass information such as the page name that the user is on or the email address that the form should be posted to.

Note that the input tag closes itself with a '/>' at the end.

A textarea is, basically, a large textbox. It requires a rows and cols attribute and is used like this:

<textarea rows="5" cols="20">A big load of text here</textarea>

The select tag works with the option tag to make drop-down select boxes.

They work like this:

<select> <option value="first option">Option 1</option> <option value="second option">Option 2</option> <option value="third option">Option 3</option> </select>

When the form is submitted, the value of the selected option will be sent.

Similar to the checked attribute of checkboxes and radio buttons, an option tag can also have a selected attribute, which would be used in the format <option value="mouse" selected="selected">Rodent</option>.

All of the tags mentioned above will look very nice presented on the page, but if you hook up your form to a form-handling program, they will all be ignored. This is because the form fields need names. So to all of the fields,

the attribute name needs to be added, for example <input type="text" name="talkingsponge" />

A form might look like the one below. (Note: this form will not work unless there is a 'contactus.php' file, which is stated in the action attribute of the form tag, to handle the submitted date)

Document info
Document views56
Page views56
Page last viewedSun Jan 22 01:42:43 UTC 2017