umm... i'm confused from $_GET/$_POST but i often used $_POST n sometimes $_GET for one to one html.. here's my code :
home.php :
<form action="buy.php" method="POST">
<input type="image" name="product" value="Noodle" src="images/Noodle.jpg" height="290" width="333">
<input type="image" name="product" value="Rice" src="images/Rice.jpg" height="290" width="333">
<input type="image" name="product" value="tofu" src="images/tofu.jpg" height="290" width="333">
</form>
buy.php :
<?php
$product = $_POST["product"];
echo "You have ordered a bowl of ". $product . '!' . " Do you need to get extra beverages?"; ?>
<div>
<form action="main_menu.php" method="GET">
<input type="submit" name="SUBMIT" value="NO">
<h3> Choose extra Menu </h3>
<form action="extra_menu.php" method="GET"> `
<table bgcolor="#B0D8E2" border="0" cellpadding="2" width="180">
<tr> <td valign="middle">
<input type="image" name="name" value="dumplings" src="images/dumplings.jpg" height="300" width="300">
</td>
</tr>
</table>
<table bgcolor="#B0D8E2" border="0" cellpadding="2" width="180">
<tr>
<td valign="middle">
<input type="image" name="name" value="cayenne" src="images/cayenne.jpg " height="300" width="300">
</td></tr>
</table>
main_menu.php :
<?php
echo $product . "your main product will be sent soon!";
?>
extra_menu.php :
<?php
echo "you have ordered". htmlspecialchars($_GET["name"]) . '!' . " Please wait a moment!";
?>
Only on the main_menu.php i got Notice: Undefined variable: product
i ever tried to add $product=$_POST["product"]; but still undefined variable x_x
why the variable i defined before cant recognized? 0w0
0 comments:
Post a Comment