Available elements

Now it is time to add in some form elements - there are quite a few to choose from. Here are a list of the most important ones for PHP usage:

Element

Description

input type="checkbox"

A check box that lets users select multiple options

input type="file"

A text box plus a button that opens a file selection dialog

input type="hidden"

A hidden form element where you set the value

input type="password"

A text box where the text is replaced by a password character (usually asterisk *)

input type="radio"

A radio button. Radio buttons are liked grouped check boxes - you can only select one at a time

input type="reset"

A button to clear the form. It's one of the weird oddities of the web that this still exists - do you know anyone who uses it?

input type="submit"

A button to submit the form

input type="text"

A text box

option

An option in a "select" element

select

A list box; can also be a drop down list box

textarea

multi-line text box

There are four special elements in there that are of particular note: "file" elements actually upload files to the server, and can take quite a time to transfer if the connection speed is slow - handling file uploads is covered later. Hidden elements don't appear on your users screen - they are useful when keeping information across forms and pages, or simply just to force input for certain fields.

Password elements hide the password on the client side by using *s or something similar, but it is important to note that the password is still sent in plain text - no encryption is done. Finally, text area elements need a closing tag, with the text in between forming their content, i.e.: <textarea>Some text</textarea>.

 

Next chapter: A working form >>

Previous chapter: GET and POST

Jump to:

 

Home: Table of Contents

Follow us on Identi.ca or Twitter

Username:   Password:
Create Account | About TuxRadar