Hands On: Representing Web Forms in HTML
In this lesson, we'll see how web forms are represented in HTML. Let's begin!
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 action="ProcessAtServer.html"><input type="submit" value="Do it!"/></form>
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 ...