I am new to PHP and learning it using examples and online tutorials.
My goal is to use an HTML form (with a ‘Submit’ button) for collecting inputs from the user and then using PHP to collect the inputs and process them on the server.
I have tried several examples that were available online, but couldn’t get any of them to work on my computer.
This example is supposed to collect an input and simply echo it back.
[B][I][U]The HTML code:
[I][COLOR=”DarkOrange”]<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>
[B][U]The PHP code (file saved as “process.php”):
[I][COLOR=”DarkOrange”]<html><body>
<?php
$quantity = $_POST[‘quantity’];
$item = $
echo “You ordered “. $quantity . ” ” . $item . “.<br />”;
echo “Thank you for ordering from Tizag Art Supplies!”;
?>
</body></html>
[B][U]The output (in Chrome):
[COLOR=”DarkOrange”]“; echo “Thank you for ordering from Tizag Art Supplies!”; ?>
Thanks in advance for your support! ?