sapper6fd Posted January 10, 2011 Share Posted January 10, 2011 Hello all, So I've picked up a PHP book in an attempt to learn it. The issue I'm having is preventing me from getting any further. They have me creating a simple order form, but the data is not passing from the HTML page to the PHP Processing file. I know there are other ways of doing this that I'm unaware of, but this code is verbatam to what we are isntructed to type within the book itself. Here is the code orderform.html: <html> <body> <form action="processorder.php" method="post"> <table border="0"> <tr bgcolor="#cccccc"> <td width="150">Item</td> <td width="15">Quantity</td> </tr> <tr> <td>Tires</td> <td align="center"><input type="text" name="tireqty" size="3" maxlength="3"></td> </tr> <tr> <td>Oil</td> <td align="center"><input type="text" name="oilqty" size="3" maxlength="3"></td> </tr> <tr> <td>Spark Plugs</td> <td align="center"><input type="text" name="sparkqty" size="3" maxlength="3"></td> </tr> <tr> <td>How did you find Bob's?</td> <td><select name="find"> <option value = "a">I'm a regular customer</option> <option value = "b">TV advertising</option> <option value = "c">Phone directory</option> <option value = "d">Word of mouth</option> </select> </td> </tr> <tr> <td colspan="2" align="center"><input type="submit" value="Submit Order"></td> </tr> </table> </form> </body> </html> processorder.php: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Bobs Auto Parts - Order Results</title> </head> <body> <h1>Bobs Auto Parts</h1> <h2>Order Results</h2> <?php $tireqty = $_post['tireqty']; $oilqty = $_post['oilqty']; $sparkqty = $_post['sparkqty']; echo "<p>Order Processed at "; echo date('H:i, jS F Y'); echo "</p>"; echo '<p>Your order is as follows: </p>'; echo $tireqty.' tires<br />'; echo $oilqty.' bottles of oil<br />'; echo $sparkqty.' spark plugs<br />'; $totalqty = 0; $totalamount = 0.00; define('TIREPRICE', 100); define('OILPRICE', 10); define('SPARKPRICE', 4); ?> </body> </html> For some reason the values on the processing form dont show up. The only text thats displayed is : Bobs Auto Parts Order Results Order Processed at 17:07, 9th January 2011 Your order is as follows: tires <---- Should be showing the total quantity ordered bottles of oil <---- Should be showing the total quantity ordered spark plugs <---- Should be showing the total quantity ordered Is anyone able to let me know where the error is in this code? The writers website isnt any help.... Regards, sapper6fd Quote Link to comment https://forums.phpfreaks.com/topic/223917-variables-not-passing/ Share on other sites More sharing options...
Pikachu2000 Posted January 10, 2011 Share Posted January 10, 2011 $_post is notr the same as $_POST. Variables are case sensitive. Quote Link to comment https://forums.phpfreaks.com/topic/223917-variables-not-passing/#findComment-1157224 Share on other sites More sharing options...
sapper6fd Posted January 10, 2011 Author Share Posted January 10, 2011 Man oh man, your a star. I cant believer I missed that. I went over this code over and over again, looked right at that a million timees and it never even occured to me. Thanks so much. Quote Link to comment https://forums.phpfreaks.com/topic/223917-variables-not-passing/#findComment-1157229 Share on other sites More sharing options...
PFMaBiSmAd Posted January 10, 2011 Share Posted January 10, 2011 If you set error_reporting to E_ALL and display_errors to ON in your master php.ini so that all the errors that php finds will be reported and displayed, php will help you find problems like that. Quote Link to comment https://forums.phpfreaks.com/topic/223917-variables-not-passing/#findComment-1157233 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.