Website Magazine

HTML Forms

First off, this section will only tell you how to make a form, not how to do anything with it. I hope to have php and javascript form processing and validation pages up soon. In the meantime, lets talk about forms in general. Below is a table of commonly used form control elements:

Type:

Code/Description:

Example:

Text

 

<input type=”text” name=”name” maxlength=”20″>

- Displays an input field that allows text to be entered by the user

Submit

 

<input type=”submit” value=”Submit me”>

- Sends the form off to perform processing of form.

Checkbox

 

<input type=”checkbox” name=”news” value=”htmlformat” >

- Displays a checkbox–make the name field is the same for each checkbox that is in the same group.

Please choose what type newsletter to subscribe to:

HTML

Plain Text

Radio

 

<input type=radio” value=”18-30″ name=”age” >

- Radio button. Give same name to each radio button. Only one is allowed to be selected.

18-30

31-45

46-60

60+

Reset

 

<input type=”submit” value=”Submit me”>

- Sends the form off to perform processing of form.

 

Textarea

 

<textarea name=”comments” rows=” rows=”6″ cols=”50″></textarea>

Filed under: HTML

Comments are closed.