php - i have issue with POST, (im new and need help) -
im following book tutorial , im stuck.
here html orderform (orderform.html)
<!doctype html> <html> <head> </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 colspan=2 align=center><input type=submit value="submit order"></td> </td> </table> </form>
here process order form (processorder.php)
<!doctype html> <html> <head> <title>bobs auto parts - order results</title> </head> <body> <h1>bob's auto parts</h1> <h2>order results</h2> <?php echo "<p>order processed @ "; echo date("1 js \of f y h:i:s: a"); echo "<br>"; echo "<p>your order follows:"; echo "<br>"; echo $tireqty." tires<br>"; echo $oilqty." bottles of oil<br>"; echo $sparkqty." spark plugs<br>"; var_dump($_post);
?>
when var_dump $_post on processorder.php says in array when try , echo variables gives me notice variables i'm trying carry on undifined. please :(
you must echo these :
if (isset($_post['tireqty'])) { echo $_post['tireqty']; } if (isset($_post['oilqty'])) { echo $_post['oilqty']; } if (isset($_post['sparkqty'])) { echo $_post['sparkqty']; }
Comments
Post a Comment