我在将输入数据从一页显示到另一页时遇到问题
当我们单击提交按钮时,我尝试传输它
这是我的代码,我尝试传输数据
function cart() {
$total = 0;
foreach($_SESSION as $name => $value) {
if ($value>0) {
if (substr($name, 0, 5) == 'cart_'){
$id = substr($name, 5, (strlen($name)-5));
$get = mysql_query('SELECT id, name, price FROM menu WHERE id=' .mysql_real_escape_string((int)$id));
while ($get_row = mysql_fetch_assoc($get)){
$sub = $get_row['price'] * $value;
echo $get_row['name'].' x '.$value.' @ $'.number_format($get_row['price'], 2).' = $'.number_format($sub, 2).' <a href="cart.php?remove='.$id.'">[-]</a> <a href="cart.php?add='.$id.'">[+]</a> <a href="cart.php?delete='.$id.'">[Delete]</a><br />' ;
}
}
$total += $sub;
}
}
if ($total == 0){
echo "Your Cart Is Empty";
}
else {
echo "<p>Total : $".number_format($total, 2).'</p>';
<p>
<form action="bill.php" method="post">
<?php paypal_items(); ?>
<input type="submit" value="submit" />
</form>
</p>
}
}
我尝试将此行显示到另一个页面
echo $get_row['name'].' x '.$value.' @ $'.number_format($get_row['price'], 2).' = $'.number_format($sub, 2).' <a href="cart.php?remove='.$id.'">[-]</a> <a href="cart.php?add='.$id.'">[+]</a> <a href="cart.php?delete='.$id.'">[Delete]</a><br />' ;
我只是试试这段代码,我得到了错误
比尔.php
<?php
echo $get_row['name'].' x '.$value.' @ $'.number_format($get_row['price'], 2).' = $'.number_format($sub, 2);
?>
错误
Notice: Undefined variable: get_row in C:\xampp\htdocs\shopping\bill.php on line 2
Notice: Undefined variable: value in C:\xampp\htdocs\shopping\bill.php on line 2
Notice: Undefined variable: get_row in C:\xampp\htdocs\shopping\bill.php on line 2
Notice: Undefined variable: sub in C:\xampp\htdocs\shopping\bill.php on line 2
x @ $0.00 = $0.00
有谁知道怎么做???
我只是这个领域的新手......
谢谢