あるページから別のページへの入力データの表示で問題が発生しました
送信ボタンをクリックすると転送しようとします
これは私がデータを転送しようとしている私のコードです
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 />' ;
そして、私はこのコードを試してみましたが、エラーが発生しました
bill.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
誰もがそれを行う方法を知っていますか?
私はこの分野の初心者です...
ありがとう