Blogging Platfrm


Basic HTML Form Components

HTML form elements are used to insert the form in the document. It is a method that allow author to collect information of users or visitors. The visitors only should fill up the form and then send by simply clicking submit button.

Attributes of form tag are:-

  • name=" ";
  • method=" "; // It can be simply post or get.
  • action=" ";// It is destination of data that is to be sent.
  • enctype=" ";// multiport/form-data .It is used for file like image, video etc 

<form action="test.php">
<legend>My Information</legend>
Name: <input type="text" name="name" />
Address: <input type="text" name="address" />
Email: <input type="email" name="email" />
Phone: <input type="text" name="phone" />
 <input type="submit" value="Submit">

Form Components

Textbox: This component is always used in form element. It is used to fill the form like Name or that box which only contains words.
<input type="text"/>
value=" "// default character on load
name=" "// unique identification in form
size=" "//width in no. of characters
maxlength=" "//maximum no. of characters allowed
placeholder=" "
<input type="text" value="name" name="n1" size="10" maxlength="20"/>
Passwordbox: Only used to fill the password box.
<input type=""password/>
Attributes: The attributes are same like the textbox such as name, size, maxlength and also placeholder.
Text Area: It is used to fill the box by long description.
Lets see the syntax. It syntax is little bit different than other form components. 
<text area></textarea> // Unlike the input tag, it is pair tag.
Its attributes are also very similar to textbox like name but it also has rows and cols.
<textarea name="area" rows="50" cols="20">.....</textarea>
Radio button: Radio button is used to select one element at a time. Lets see and example then you will know better about it.
<input type="radio" name="gender" value="male"/>Male
<input type="radio" name="gender" value="female"/>Female
Checkbox: It is used to select multiple values.
<input type="checkbox" name="abc[name of array for large data]"/>Football
<input type="checkbox" name="abc[name of array for large data]"/>Cricket
Select box: Just use the following code and then you can find how it works. Actually it is used to select an option form multiple data of dropdown box.
<select name=" "/>
<option value="Nepal" selected="selected">Nepal</option>
<option value="India">India</option>
<option value="China">China</option>
<option value="USA">USA</option>
File field: File field is used actually in order to have the image.
<input type="file" name="picture" multiple/>


Popular Posts

Blog Archive