0% found this document useful (0 votes)
27 views1 page

Order - HTML Code:: PHP Form Processor

The document discusses creating an order form in HTML and a PHP form processor to handle the submitted form data. The HTML form allows the user to select an item (paint, brushes, erasers) and enter a quantity. The process.php file uses the $_POST associative array to get the item and quantity values submitted from the form and displays a confirmation message showing the item and quantity ordered.

Uploaded by

Anil Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views1 page

Order - HTML Code:: PHP Form Processor

The document discusses creating an order form in HTML and a PHP form processor to handle the submitted form data. The HTML form allows the user to select an item (paint, brushes, erasers) and enter a quantity. The process.php file uses the $_POST associative array to get the item and quantity values submitted from the form and displays a confirmation message showing the item and quantity ordered.

Uploaded by

Anil Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

order.

html Code:
<html><body>
<h4>Tizag Art Supply Order Form</h4>
<form action="process.php" method="post">
<select name="item">
<option>Paint</option>
<option>Brushes</option>
<option>Erasers</option>
</select>
Quantity: <input name="quantity" type="text" />
<input type="submit" />
</form>
</body></html>

Now that our "order.html" is complete, let us continue on and create the "process.php" file which will
process the HTML form information.

PHP Form Processor

We want to get the "item" and "quantity" inputs that we have specified in our HTML form. Using an
associate array (this term is explained in the array lesson), we can get this information from the $_POST
associative array.
The proper way to get this information would be to create two new variables, $item and $quantity and set
them equal to the values that have been "posted". The name of this file is "process.php".

process.php Code:
<html><body>
<?php
$quantity = $_POST['quantity'];
$item = $_POST['item'];

echo "You ordered ". $quantity . " " . $item . ".<br />";
echo "Thank you for ordering from Tizag Art Supplies!";

?>
</body></html>

As you probably noticed, the name in $_POST['name'] corresponds to the name that we specified in our
HTML form.
Now try uploading the "order.html" and "process.php" files to a PHP enabled server and test them out. If
someone selected the item brushes and specified a quantity of 6, then the following would be displayed on
"process.php":

You might also like