Examples Form Page


Form not using <Label for=> tag

Name:

Email: 

What credit cards do you have?

Visa
Mastercard
American Express

Do you wish to subscribe to Newsletter?

No
Yes

Selection the Operating system?

Example code for form controls

<form action="" method="post" name="maillist" id="maillist"></p>
<p>Name: <input name="name" type="text" size="20" /></p>
<p>Email:&nbsp; <input type="text" name="email" size="40" /></p>
<p> What credit cards do you have?</p>
<input type="checkbox" name="visa" /> Visa <br />
<input type="checkbox" name="mc" /> Mastercard <br />
<input type="checkbox" name="amex" /> American Express <br />
<p>Do you wish to subscribe to Newsletter?</p>
<p><input type="radio" name="yes_no" /> No <br />
<input type="radio" name="yes_no" />Yes</p>
Selection the Operating system? <select name=refer SIZE=1>
<option value='' SELECTED>--- Select ---</option>
<option value =winxp>Windows XP
<option value =mac>Mac OS X
<option value =linux>Linux
</select>
<p><input type="submit" name="Submit" value="Submit" /> </p>
</form>

Form using <Label for=> tag

 

What credit cards do you have?




Do you wish to subscribe to Newsletter?


Code showing <Label for >

<form action=" " method="post" name="maillist" id="maillist"></p>
<p><label for="un_1">Name:&nbsp; </label><input name="name" type="text" id="un_1" size="20" /></p>
<p><label for="un_2">Email: </label>&nbsp; <input type="text" name="email" id="un_2" size="40" /></p>
<p> What credit cards do you have?</p>
<input type="checkbox" name="visa" id="un_3"/><label for="un_3">Visa</label> <br />
<input type="checkbox" name="mc" id="un_4" /> <label for="un_4">Mastercard</label> <br />
<input type="checkbox" name="amex" id="un_5"/> <label for="un_5">American Express</label> <br />
<p>Do you wish to subscribe to Newsletter?</p>
<p><input type="radio" name="subyes" id="un_8"/><label for="un_8">No</label><br />
<input type="radio" name="subyes"id="un_9"/> <label for="un_9">Yes</label> </p>
<label for="un_6">Selection the Operating system?&nbsp;&nbsp;</label> <select name=refer SIZE=1 id="un_6">
<option value='' SELECTED>--- Select ---</option>
<option value =winxp>Windows XP
<option value =mac>Mac OS X
<option value =linux>Linux
</select>
<p><input type="submit" name="Submit" value="Submit" /> </p>
</form>

Grouping form controls using <Fieldset> and <Legend> tags

1: Personal Information

2: Spouses Information

Code Showing Fieldset and Legends

<fieldset>
<legend><b>1: Personal Information</b></legend>
<label for="un1">Name </label><input type="text" name="name" id="un1">
<label for="un2">Email</label> <input type="text" name="email" id="un2">
</fieldset></p>
<fieldset>
<legend><b>2: Spouses Information</b></legend>
<label for="un3">Name </label><input type="text" name="name" id="un3">
<label for="un4">Email</label> <input type="text" name="email" id="un4">
</fieldset>