When we want to take(collect) information from user or those who are visiting site, for this purpose html forms are use.
for eg:- for user registration in any social site, we want to collect his personal information like his name,last name, email, address etc.
A form will take information from user and then send it to back-end application such as Script or PHP script etc.
Below are some form elements which are available.
- Text fields
- Textarea
- Drop down
- Radio buttons
- Checkboxes
Syntax
<form action="Script URL" method="GET|POST">
here come form elements like checkboxes, Radio buttons, text fields etc.
</form>
Form elements or form controls
Text field :- this is use to take text input from user like name last name etc.
Syntax
<form >
NAME: <input type="text" name="name" />
<br>
ADDRESS: <input type="text" name="address" />
</form>
Radio button :- This button is used when user have to select one option from two or many.
Syntax
<form>
<input type="radio" name="sex" value="male"> Male
<input type="radio" name="sex" value="female"> female
</form>
Checkbox :- It let the user select one or more options from many options. In radio button you can only select one option not more than one.
Syntax
<form>
<input type="checkbox" name="car" value="honda"> I have a honda<br>
<input type="checkbox" name="car" value="maruti" checked> I have a maruti<br>
</form>
Drop down :- A drop down box is also know as select box, it gives a option to list down various options in the form, that place user can select one or more that one options.
Syntax
<form>
<select name="dropdown">
<option value="Maths" selected>Maths</option>
<option value="Physics">Physics</option>
</select>
</form>
0 Comment(s)