2.7. HTML 101: accepting user input
The Break Neck order form already has fields for the customer to enter in their phone number, address, and pizza order. Let's take a quick look at the HTML for the order form, and then figure out how to connect this HTML to the JavaScript you'll be writing:
<html>
<head>
<title>Break Neck Pizza Delivery</title>
<link rel="stylesheet" type="text/css" href="breakneck.css" />All the
style for the Break Neck app is in an external CSS stylesheet.
</head>
<body>
<p>
<img src="breakneck-logo.gif"
alt="Break Neck Pizza" />
</p>
<form method="POST" action="placeOrder.php">This is the URL for placing
the pizza order once the form is completely filled out.
<p>Enter your phone number:
<input type="text" size="14" name="phone" />Here's where the customer
enters his phone number.
</p>
<p>Your order will be delivered to:</p>
<p><textarea name="address" rows="4" cols="50">You'll fill this
in with the address that the server returns, but let's leave it as a field so a customer
can enter a different address if the want.
</textarea></p>
<p>Type your order in here:</p>
<p><textarea name="order" rows="6" cols="50"></textarea></p>
<p><input type="submit" value="Order Pizza" /></p>A normal
"submit" button is used for placing the order, using a form POST.
</form>
</body>
</html>
 |