Hands On: Representing Web Forms in HTML
Explore how to build simple web forms using HTML's form and input elements. Learn to set form actions, handle data submission through URLs, and create interactive forms for your web pages.
We'll cover the following...
We'll cover the following...
Making use of the <form> tag
The key HTML element is <form>, which defines a web form within a page. The simplest web form takes only a few lines of markup:
form markup in html5
This <form> contains a single <input> tag that is decorated with the type="submit" attribute, and it represents a submit button.
The action property of <form> is set to ProcessAtServer.html, so when the user clicks the submit button, the content of the form will be sent to that page.
<!DOCTYPE html>
<html>
<head>
<title> Simplest Form</title>
<link href="style.css" rel="stylesheet" />
</head>
<body>
<form action="ProcessAtServer.html">
<input type="submit" value="Do it!"/>
</form>
</body>
</html>
Of course, as shown in the image ...