The <input type="text"> defines a single-line input field for text input.
The <input type="radio"> defines a radio button.
Radio buttons let a user select ONE of a limited number of choices.
The <input type="checkbox"> defines a checkbox.
Checkboxes let a user select ZERO or MORE options of a limited number of choices.
value attribute.<form action="...">, <label for="...">, and <input type="text">.<!DOCTYPE html> <html> <head> <title>Basic Text Form</title> </head> <body> <h2>User Registration</h2> <form action="/register_page.php"> <label for="fname">First name:</label><br> <input type="text" id="fname" name="fname" value="Arib"><br> <label for="lname">Last name:</label><br> <input type="text" id="lname" name="lname" value="Shaikh"> </form> </body> </html>
<input type="text"> element defines a single-line input field. Connecting labels via for attribute to an input's id improves accessibility.
name attributes.<!DOCTYPE html> <html> <head> <title>Radio Buttons Example</title> </head> <body> <h3>Choose your favorite Web language:</h3> <form> <input type="radio" id="html" name="fav_language" value="HTML"> <label for="html">HTML</label><br> <input type="radio" id="css" name="fav_language" value="CSS"> <label for="css">CSS</label><br> <input type="radio" id="javascript" name="fav_language" value="JavaScript"> <label for="javascript">JavaScript</label> </form> </body> </html>
name attribute.
<input type="checkbox"> with unique id and name values for each option.<!DOCTYPE html> <html> <head> <title>Checkboxes Example</title> </head> <body> <h3>Select your Vehicles:</h3> <form action="/action_page.php"> <input type="checkbox" id="vehicle1" name="vehicle1" value="Bike"> <label for="vehicle1"> I have a bike</label><br> <input type="checkbox" id="vehicle2" name="vehicle2" value="Car"> <label for="vehicle2"> I have a car</label><br> <input type="checkbox" id="vehicle3" name="vehicle3" value="Boat"> <label for="vehicle3"> I have a boat</label> </form> </body> </html>
/action_page.php.<input type="submit" value="Submit"> to define the submission button.<!DOCTYPE html> <html> <head> <title>Form Submission Example</title> </head> <body> <h2>HTML Forms</h2> <form action="/action_page.php"> <label for="fname">First name:</label><br> <input type="text" id="fname" name="fname" value="Arib"><br> <label for="lname">Last name:</label><br> <input type="text" id="lname" name="lname" value="Shaikh"><br><br> <input type="submit" value="Submit"> </form> <p>If you click the "Submit" button, the form-data will be sent to a page called "/action_page.php".</p> </body> </html>
If you click the "Submit" button, the form-data will be sent to a page called "/action_page.php".
<input type="submit"> button triggers form submission, sending all input values identified by their name attributes to the endpoint specified in the form's action attribute.