tcpa41 Posted May 19, 2009 Share Posted May 19, 2009 Hello,i was playing around with php and noticed a strange problem i cannot solve,i think its because data from form.html Isn't written to $post array. Im getting Undefined index problem. Ty for all help in advance :-\ form.html <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"><button type="submit" style="height: 25px; width: 100px"><strong> SendIt</strong></button> </td> </tr> </table> </form> processorder.php <?php // create short variable names $tires = $_POST["tireqty"]; $oil = $_POST["oilqty"]; $spark = $_POST["sparkqty"]; echo "<p>Your order is as follows: </p>"; echo $tires." tires<br />"; echo $oil." bottles of oil<br />"; echo $spark." spark plugs<br />"; ?> Link to comment https://forums.phpfreaks.com/topic/158712-solved-noob-php-problem/ Share on other sites More sharing options...
genericnumber1 Posted May 19, 2009 Share Posted May 19, 2009 You're using the wrong types of quotes on the form's HTML for one... Link to comment https://forums.phpfreaks.com/topic/158712-solved-noob-php-problem/#findComment-837046 Share on other sites More sharing options...
Masna Posted May 19, 2009 Share Posted May 19, 2009 This looks like it should work. But, just to be sure, try replacing this... <button type="submit" style="height: 25px; width: 100px"><strong> SendIt</strong></button> ...with this... <input type="submit" name="submit" value="SendIt"> Link to comment https://forums.phpfreaks.com/topic/158712-solved-noob-php-problem/#findComment-837047 Share on other sites More sharing options...
tcpa41 Posted May 19, 2009 Author Share Posted May 19, 2009 ouch , ty for pointing out my prob,it works now. I just needed to replace quotes Link to comment https://forums.phpfreaks.com/topic/158712-solved-noob-php-problem/#findComment-837050 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.