Databases Reference
In-Depth Information
Figure 14-2. The HTML entry form shown in the Firefox web browser
<title>Add an Artist and Album</title>
</head>
<body>
<form action="add.php" method="GET">
Artist name: <input type="text" name="artist" />
<br />
Album name: <input type="text" name="album" />
<br />
<input type="submit" />
</form>
</body>
</html>
When it's rendered in the Firefox web browser, the HTML page looks as shown in
Figure 14-2. You can see we've entered the artist name Morrissey and the album You
are the Quarry in the fields.
In our HTML example, the <form> tag has two attributes, action and method . The
action attribute tells the browser what resource to request when the user submits the
form. In this example, it's add.php . The method attribute tells the browser how to send
the data entered into the form to the web server. With the GET method that's used in
the example, the data is appended to the URL. For example, if the user types
Morrissey and You are the Quarry in the fields and the web server runs at the address
localhost , the URL that's requested when the form submits is:
http://localhost/add.php?artist=Morrissey&album=You+are+the+Quarry
Notice that the name attributes of the <input> elements, artist and album , are paired
with the values that the user typed in the fields. You can also see that the space char-
acters in You are the Quarry are translated into + characters, since the HTTP standard
doesn't allow spaces in URLs.
 
Search WWH ::




Custom Search