johne281 Posted July 9, 2009 Share Posted July 9, 2009 Hi I am learning php and i have a problem. The code i have written so far is not displaying. The title is visible at the top of the page so i know it is reading the file but nothing displays on the page itself. Here is my code: <html> <head> <title>Bob's Auto Parts - Order Results</title> </head> <?php //create short variable names $tireqty = $_POST('tireqty'); $oilqty = $_POST('oilqty'); $sparkqty = $_POST('sparkqty') ?> <body> <h1>Bob's Auto Parts</h1> <h2>Order Results</h2> <?php echo "<p>Order processed at ".date('H:i, js FY')."</p>"; echo '<p>Your order is as follows: </p>'; echo $tireqty.' tires<br/>'; echo $oilqty.' bottles of oil<br/>'; echo $sparkqty. ' spark plugs<br/>' ?> </body> </html> It is linked to an order form and everything was working fine earlier. But i dont know whats going on now, Quote Link to comment Share on other sites More sharing options...
johne281 Posted July 9, 2009 Author Share Posted July 9, 2009 Here is the code for the order form. <html> <head><title>Bob's Auto Parts</title></head> <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> Quote Link to comment Share on other sites More sharing options...
AwptiK Posted July 9, 2009 Share Posted July 9, 2009 You have to use $_POST['name'] not () Also, make sure you have ; on your third $var = $_POST['name']; line. Quote Link to comment Share on other sites More sharing options...
johne281 Posted July 9, 2009 Author Share Posted July 9, 2009 thank you kind sir/madam. Problem solved Quote Link to comment 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.