Define Html Forms ?

An HTML form is used to collect user input. The user input is most often sent to a server for processing , HTML form facilitates the user to enter data that is to be sent to the server for processing such as name, email address, password, phone number.

The Html element is used to create an HTML form for user input.Html Form Syntax :-

<form>
form elements
</form>

The element is a container for different types of input element, such as :text fields, checkboxes, radio buttons, submit buttons.
Html Code:- 
<!DOCTYPE html>
<html>
<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="John"><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" value="Doe"><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>

Html <input> Element
The HTML <input> element is the most used form element.
An <input> element can be displayed in many ways, depending on the type attribute.
The HTML <input> element is the most used form element.

An <input> element can be displayed in many ways, depending on the type attribute.

Text Fields
The <input type="text"> defines a single-line input field for text input.
Example
A form with input fields for text:
HTML field example:-


<form>
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname"><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname">
</form>

Leave a Comment