r — моя корзина php не работает должным образом на сервере и не перенаправляет на страницу корзины

пожалуйста, найдите ошибку в моем коде, он не перенаправляет на cart-page.php, перенаправляет ли на
http://allsolution.co/product-page.php?productid=1&команда = добавить. он отлично работает на локальном хосте и не выдает ошибку муравья на сервере.
введите код сюда
продукт-page.php

         <?php
include("include/db.php");
include("include/functions.php");

if(isset($_REQUEST['command']) && $_REQUEST['command']=='add' && $_REQUEST['productid']>0){
$pid=$_REQUEST['productid'];
addtocart($pid,1);
header("location:cart-page.php");
exit();

}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<!-- BEGIN html -->
<html xmlns="http://www.w3.org/1999/xhtml">

<!-- BEGIN head -->
<head>

<!-- Meta Tags -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<!-- Title -->
<meta name="description" content="My Clean Web Store" />
<title>All Solution</title>
<script language="javascript">
function addtocart(pid){
document.form1.productid.value=pid;
document.form1.command.value='add';
document.form1.submit();
}
</script><!-- END head -->
</head>
<div id="central_content"><script language="javascript">
function addtocart(pid){
document.form1.productid.value=pid;
document.form1.command.value='add';
document.form1.submit();
}
</script><body>
<form name="form1">
<input type="hidden" name="productid" />
<input type="hidden" name="command" />
</form>
<div align="center">
<h1 align="center">Henger2</h1>
<table border="0" cellpadding="2px" width="600px">
<?php
$result=mysql_query("SELECT * FROM `products` WHERE serial=1");
while($row=mysql_fetch_array($result)){
?>
<tr>
<td></td><td> <div class="product_item"> <div class="product_left"> <a href="<?=$row['picture']?>" class="simple_image" title=""><span class="product_zoom" style="display: none;"><img src="styles/Images/ico-zoom.png" alt="Zoom Picture" title="Zoom Picture" style="border:none;"/></span><img src="<?=$row['picture']?>" alt="Image 1" title=""/></a>
<div class="product_thumb_container">
</div>
</div>
</div>
</td>

<td>

<div class="product_right">

<div class="product_data">Product:</div>
<div class="product_data grey"><?=$row['name']?></div>
<div class="div_br"></div>
<div class="product_data">Product-Softwares:</div>
<div class="product_data grey"><?=$row['description']?></div>
<div class="div_br"></div>
<div class="product_data">Software-Format:</div>
<div class="product_data grey"><?=$row['desc']?></div>
<div class="div_br"></div>
<div class="product_data">Price:</div>
<div class="product_data grey">$<?=$row['price']?></div>
<div class="div_br"></div><input type="button" value="Add to Cart" onclick="addtocart(<?=$row['serial']?>)" />
</td>
</tr>
<tr><td colspan="2"></td>
<?php } ?>
</table>
</div>
<div style="clear:both;"></div>

<div id="product_tabs" class="clear"></div>
<div class="s_tabs grid_12 alpha omega">
<ul class="s_tabs_nav clearfix">
<li><a href="#product_description">Description</a></li>

</ul>
<div class="s_tab_box">
<div id="product_description">
<div class="description_title blue">Lorem Ipsum</div>
<div class="description_text">Heading Proin ut ornare risus. Sed tristique, massa vel rhoncus tempus, ligula quam ultrices enim, varius euismod neque erat quis Clip on the <b>worlds most wearable music player</b> and take up to 240 songs with you anywhere. Choose from five colors including four new hues to make your musical fashion statement...</div>
<div class="description_title">Random Irpef</div>
<div class="description_text">Heading Proin ut ornare risus. Sed tristique, massa vel rhoncus tempus, ligula quam ultrices enim, varius euismod neque erat quis Clip on the worlds most wearable music player and take up to 240 songs with you anywhere. Choose from five colors including four new hues to make your musical fashion statement...</div>
</div>

</div>
</div>
</div><!-- END #central_content-->
</div>
<div id="footer">
</div>

<!-- END body -->
</body>

<!-- END html -->
</html>

cart-page.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<!-- BEGIN head -->
<head>

<!-- Meta Tags -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<!-- Title -->
<meta name="description" content="My Clean Web Store" />
<title>All Solution</title>
<script language="javascript">
function del(pid){
if(confirm('Do you really mean to delete this item')){
document.form1.pid.value=pid;
document.form1.command.value='delete';
document.form1.submit();
}
}
function clear_cart(){
if(confirm('This will empty your shopping cart, continue?')){
document.form1.command.value='clear';
document.form1.submit();
}
}
function update_cart(){
document.form1.command.value='update';
document.form1.submit();
}</script>

<!-- END head -->
</head>
<body>
<div id="main">
<div class="divisorydiv2" style="height:37px;"></div>
<?php

include("include/db.php");
include("include/functions.php");

if(isset($_REQUEST['command']) && $_REQUEST['command']=='delete' && $_REQUEST['pid']>0){
remove_product($_REQUEST['pid']);
}
else if(isset($_REQUEST['command']) && $_REQUEST['command']=='clear'){
unset($_SESSION['cart']);
}
else if(isset($_REQUEST['command']) && $_REQUEST['command']=='update'){
$max=count($_SESSION['cart']);
for($i=0;$i<$max;$i++){
$pid=$_SESSION['cart'][$i]['productid'];
$q=intval($_REQUEST['product'.$pid]);
if($q>0 && $q<=999){
$_SESSION['cart'][$i]['qty']=$q;
}
else{
$msg='Some proudcts not updated!, quantity must be a number between 1 and 999';
}
}
}?>
<script language="javascript">
function del(pid){
if(confirm('Do you really mean to delete this item')){
document.form1.pid.value=pid;
document.form1.command.value='delete';
document.form1.submit();
}
}
function clear_cart(){
if(confirm('This will empty your shopping cart, continue?')){
document.form1.command.value='clear';
document.form1.submit();
}
}
function update_cart(){
document.form1.command.value='update';
document.form1.submit();
}</script>

<form name="form1" method="post">
<input type="hidden" name="pid" />
<input type="hidden" name="command" />
<div style="margin:0px auto; width:600px;" >
<div style="padding-bottom:10px">
<h1 align="center">Your Shopping Cart</h1>
<input type="button" value="Continue Shopping" onclick="window.location='projects.php'" />
</div>
<div style="color:#F00"></div>
<table border="0" cellpadding="5px" cellspacing="1px" style="font-family:Verdana, Geneva, sans-serif; font-size:11px; background-color:#E1E1E1" width="100%">
<?php

if(is_array($_SESSION['cart'])){
echo '<tr bgcolor="#FFFFFF" style="font-weight:bold"><td>Serial</td><td>Name</td><td>Price</td><td>Qty</td><td>Amount</td><td>Options</td></tr>';
$max=count($_SESSION['cart']);
for($i=0;$i<$max;$i++){
$pid=$_SESSION['cart'][$i]['productid'];
$q=$_SESSION['cart'][$i]['qty'];
$pname=get_product_name($pid);
if($q==0) continue;
?>
<tr bgcolor="#FFFFFF"><td><?=$i+1?></td><td><?=$pname?></td>
<td>$ <?=get_price($pid)?></td>
<td><input type="text" name="product<?=$pid?>" value="<?=$q?>" maxlength="3" size="2" /></td>
<td>$ <?=get_price($pid)*$q?></td>
<td><a href="javascript:del(<?=$pid?>)">Remove</a></td></tr>
<?php
}
?>
<tr><td><b>Order Total: $<?=get_order_total()?></b></td><td colspan="5" align="right"><input type="button" value="Clear Cart" onclick="clear_cart()"><input type="button" value="Update Cart" onclick="update_cart()"></td></tr>
<?php
}
else{
echo "<tr bgColor='#FFFFFF'><td>There are no items in your shopping cart!</td>";
}
?>
</table>
</div>
</form>

<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif" style="margin-left:500px; margin-top:20px;">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="business" value="[email protected]">
<?php
if(is_array($_SESSION['cart'])){
$max=count($_SESSION['cart']);
$a=1;

foreach($_SESSION['cart'] as $item){
$name=get_product_name($a);?>
<input type="hidden" name="item_name_<?php echo $a; ?>" value="<?=$name; ?>">
<input type="hidden" name="quantity_<?php echo $a; ?>" value="<?= $item['qty']; ?>">
<input type="hidden" name="amount_<?php echo $a; ?>" value="$ <?=get_price($a)?>">
<?php
$a++;
}
}?></form>
</div>

<!-- END  #main -->

<!-- END body -->
</body>

<!-- END html -->
</html>

0

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы [email protected]