Home

HTML Forms


HTML - Buttons - Submit - Reset

What are HTML Forms

Web applications usually require users to provides some input. Typically a user fills out a form by filling out details with text and/or selecting from lists of options. HTML forms provide a mechanism for displaying input boxes (and buttons) that the user can use to provide input to a web application.

simple text fields code

<form>
First name: <input name="firstname" type="text"> 
<br/>
Last name: <input name="lastname" type="text">
</form>
First name:
Last name:

simple select code

<form>
<p>Select a fruit:</p>
<select name="Fruit">
<option>Apples</option>
<option>Bananas</option>
<option>Oranges</option>
</select>
</form>

Select a fruit:

simple checkboxes

Used when you want the user to select one or more options

<form> 
<input type="checkbox" 
  name="cat" value="cat"/> I like cats 
<br/> 
<input type="checkbox" 
  name="dogs" value="dogs"/> I like dogs 
</form>
I like cats
I like dogs

simple radio buttons code

<form>
<input name="sex" type="radio" value="male"/>
 Male <br/>
<input name="sex" type="radio" value="female"/> 
Female
</form>
Male
Female

simple buttons submit, clear code

<form action="/actions/execute.aspx" method="get" name="input">
Username: <input name="username" type="text" />
<br />
<input type="submit" value="Submit" />
<input type="reset" value="Reset" />
</form>
Username:

simple textarea code

<form>
<p>Please provide your suggestion in the text box below:</p>
<textarea cols="30" rows="10"></textarea>
</form>

Please provide your suggestion in the text box below: