Help please: undefined index in sample code

From: Date: Sat, 14 Jun 2003 08:57:34 +0000
Subject: Help please: undefined index in sample code
Groups: php.windows 
Request: Send a blank email to php-windows+get-20306@lists.php.net to get a copy of this message
I can't believe Chapter 1 , section 1 and I'm off to a bad start already. Using this form and script, I keep getting "undefined index" for the variables I declare in the script. Running PHP 4.3.2 on XP Pro. Thanks. Stuart Form: <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 colspan="2" align="center"><input type="submit" value="Submit Order"></td> </tr> </table> </form> Script: <html> <head> <title>Bob's Auto Parts - Order Results</title> </head> <body> <h1>Bob's Auto Parts</h1> <h2>Order Results</h2> <?php //create short variable names $tireqty = $_POST['tireqty']; $oilqty = $_POST['oilqty']; $sparkqty = $_POST['sparkqty']; ?> <?php 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>

« previous php.windows (#20306) next »