我正在购物车,我想进入新窗口“更多关于项目”。
它是get cart.php?more=id
,但页面中没有任何内容。
cart.php - 部分代码:
$page2 = 'more.php';
if(isset($_GET['more'])){
$_SESSION['cart_'.(int)$_GET['more']];
}
function more(){
$get = mysql_query('SELECT id, name, price FROM products WHERE id='.mysql_real_escape_string($id));
while($get_row = mysql_fetch_assoc($get)){
echo '<p>'.'<b>Name: </b>'.$get_row['name'].'<br/>'.'<b>About: </b>'.$get_row['description'].'<br/>'.'<b>Quantity: </b>'.$get_row['quantity'].'<br/>'.'<b>Price: </b>'.number_format($get_row['price'], 2).' $</p>';
}
header('Location: '.$page2);
}
function products(){
$get=mysql_query('SELECT id, name, description,quantity,price FROM products WHERE quantity > 0 ORDER BY id DESC');
if (mysql_num_rows($get)==0){
echo "There are no products to display!";
}
else{
while ($get_row = mysql_fetch_assoc($get)){
echo '<p>'.'<b>Name: </b>'.$get_row['name'].'<br/>'.'<b>About: </b>'.$get_row['description'].'<br/>'.'<b>Quantity: </b>'.$get_row['quantity'].'<br/>'.'<b>Price: </b>'.number_format($get_row['price'], 2).' $'.'<a href="cart.php?add='.$get_row['id'].'"> Add</a>'.'<a href="cart.php?more='.$get_row['id'].'"> More</a></p>';
}
}
}
答案 0 :(得分:1)
你应该改变
<a href="cart.php?more='.$get_row['id'].'"> More</a>
到
<a href="cart.php?more='.$get_row['id'].'" target="_blank"> More</a>
成功!