The HTML <form> is used to collect user input.
An HTML form contains so many form elements.
Form elements are different types of input elements, like text fields, checkboxes, radio buttons, submit buttons, select box and much more.
The <input> element is one of the most important form element in HTML.
There are several <input> element can be displayed in several ways, depending on the type attribute.
<!DOCTYPE html>
<html>
<body>
<form>
Name:<br>
<input type="text" name="name">
<br> Email:
<br>
<input type="text" name="email">
</form>
<p>Note that the default width of a text input field is 20 characters.</p>
</body>
</html>
<input type="radio"> defines a radio button.
Radio button is used to choose one choice from multiple choice.
<!DOCTYPE html>
<html>
<body>
<form>
<input type="radio" name="gender" value="male" checked> Male<br>
<input type="radio" name="gender" value="female"> Female<br>
</form>
</body>
</html>
Submit button is used to submit the form after fill the form by user.
<!DOCTYPE html>
<html>
<body>
<form method=“post” action=“/action_page.php">First name:<br>
<input type="text" name="name" value="Divya">
<br>Last name:<br>
<input type="text" name="lastname" value=“divyasundar@gmail.com”>
<br><br>
<input type="submit" value="Submit">
</form>
</body>
</html>
After click on the submit button. The action work and go for preferred address That we put.
Here action_page.php file is used to process the user data for insert in database.
The method attribute specifies the HTTP method (GET or POST) to be used when submitting the form data:
You can use both GET and POST method.
GET
POST