0% found this document useful (0 votes)
33 views2 pages

HTML Form Basics and Attributes Guide

Forms

Uploaded by

dhuhithab
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views2 pages

HTML Form Basics and Attributes Guide

Forms

Uploaded by

dhuhithab
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

HTML 4.0.

1 HTML-Form

HTML Form
HTML Forms are required when you want to collect some data from the site visitor
Form Tag Attributes: action, method, target, enctype

You can use the enctype attribute to specify how the browser encodes the data before it sends it to the server.
Possible values are:
 application/x-www-form-urlencoded - This is the standard method most forms use in simple
scenarios.
 mutlipart/form-data - This is used when you want to upload binary data in the form of files like
image, word file etc.

A form tag can have elements inside it and each element is represented by
 <input>,
 <textarea>
 <button>
 <select>
 <lable>

<input> Tag:
<input type="text" name="demo" size="20" maxlength="10" readonly="readonly" disabled="disabled"
checked="checked" src="[Link]" />
Note: Not all attributes are used for same input element.
Text / Password / Checkbox / Radio / Hidden / File / Image / Reset / Submit / Button

<textarea>
To get multi line textbox:
<textarea rows="5" cols="40"></textarea>

<select> Tag: To get either Dropdownlist or Listbox.


If size or multiple attribute is provided, <select> is rendered as Listbox else it is rendered as Dropdownlist.
<select name="cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="fiat" selected>Fiat</option>
<option value="audi">Audi</option>
</select>
HTML 4.0.1 HTML-Form

<button>: Used mostly for programming web pages using JavaScript:


<button>OK</button>
<button><img src='[Link]' /></button>

Fieldset can be provided around the Form


<fieldset>
<legend>Personal information:</legend>
Name: <input type="text" name="txtName"><br>
E-mail: <input type="text" name="txtEMail"><br>
Date of birth: <input type="text" name="txtDate">
</fieldset>

Send e-mail Form


<form action="[Link] method="post" enctype="text/plain">
Name:<br>
<input type="text" name="name" value="your name"><br>
E-mail:<br>
<input type="text" name="mail" value="your email"><br>
Comment:<br>
<input type="text" name="comment" value="your comment" size="50"><br><br>
<input type="submit" value="Send">
<input type="reset" value="Reset">
</form>

You might also like