Form Codes
HTML Forms - The Input Element
The most important form element is the <input> element.
The <input> element is used to select user information.
An <input> element can vary in many ways, depending on the type attribute. An <input> element can be of type text field, checkbox, password, radio button, submit button, and more.
The most important form element is the <input> element.
The <input> element is used to select user information.
An <input> element can vary in many ways, depending on the type attribute. An <input> element can be of type text field, checkbox, password, radio button, submit button, and more.
Most common Input forms
Text field
<form> First name: <input name="firstname"><br> Last name: <input name="lastname"> </form> |
Password field
<form> Password: <input name="pwd"> </form> |
Radio Buttons
<input > defines a radio button. Radio buttons let a user select ONLY ONE of a limited number of choices: <form> <input name="sex" value="male">Male<br> <input name="sex" value="female">Female </form> |
Check Boxes
<input > defines a checkbox. Checkboxes let a user select ZERO or MORE options of a limited number of choices. <form> <input name="vehicle" value="Bike">I have a bike<br> <input name="vehicle" value="Car">I have a car </form> |
Form text box
<form method="post" action=""> <textarea name="comments" cols="25" rows="5"> Enter your comments here... </textarea> |
Submit button
A submit button is used to send form data to a server. The data is sent to the page specified in the form's action attribute. The file defined in the action attribute usually does something with the received input: <form name="input" action="html_form_action.asp" method="get"> Username: <input name="user"> <input value="Submit"> </form> |