您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息
三六零分类信息网 > 三明分类信息网,免费分类信息发布

购物车的浏览器兼容性问题

2026/4/24 12:33:56发布5次查看
从网上找了个购物车,挺好用的,简单方便,可就是存在一个问题:不兼容ie6/ie7,点击“添加购物车”按钮没反应,而内网又存在大量的ie6,我看了一下,应该是html的兼容性问题,但就是找不到问题出在哪,大家帮忙看看:
购物车主程序:cart.php:
nbsp;html>
订餐系统
products
query(select * from cart order by id asc);  
            if ($results) {
//fetch results set as object and output html  
                while($obj = $db->fetch_object($results))  
                {
                    echo '';   
                    echo '';  
                    echo 'product_img_name.'>
';  
                    echo ''.$obj->product_name.'';  
                    echo ''.$obj->product_desc.'
';  
                    echo '';  
                    echo 'price '.$currency.$obj->price.' | ';  
                    echo 'qty ';  
                    echo 'add to cart';  
                    echo '
';  
                    echo 'product_code.' />';  
                    echo '';  
                    echo '';  
                    echo '';  
                    echo '
';  
                }
}
            ?>
your shopping cart
提交按钮的链接,点按钮没反应。cart_update.php:
 10){  
        die('this demo does not allowed more than 10 quantity!
back to products.
');  
    }
//mysqli query - get details of item from db using product code  
    $results = $mysqli->query(select product_name,price from cart where product_code='$product_code' limit 1);  
    $obj = $results->fetch_object();
if ($results) { //we have the product info
//prepare array for the session variable  
        $new_product = array(array('name'=>$obj->product_name, 'code'=>$product_code, 'qty'=>$product_qty, 'price'=>$obj->price));
if(isset($_session[products])) //if we have the session  
        {  
            $found = false; //set found item to false
foreach ($_session[products] as $cart_itm) //loop through session array  
            {  
                if($cart_itm[code] == $product_code){ //the item exist in array
$product[] = array('name'=>$cart_itm[name], 'code'=>$cart_itm[code], 'qty'=>$product_qty, 'price'=>$cart_itm[price]);  
                    $found = true;  
                }else{  
                    //item doesn't exist in the list, just retrive old info and prepare array for session var  
                    $product[] = array('name'=>$cart_itm[name], 'code'=>$cart_itm[code], 'qty'=>$cart_itm[qty], 'price'=>$cart_itm[price]); 
                } 
            }
if($found == false) //we didn't find item in array  
            {  
                //add new user item in array  
                $_session[products] = array_merge($product, $new_product);  
            }else{  
                //found user item in array list, and increased the quantity  
                $_session[products] = $product;  
            }
}else{  
            //create a new session var if does not exist  
            $_session[products] = $new_product;  
        }
}
//redirect back to original page  
    header('location:'.$return_url);  
}
//remove item from shopping cart  
if(isset($_get[removep]) && isset($_get[return_url]) && isset($_session[products]))  
{  
    $product_code   = $_get[removep]; //get the product code to remove  
    $return_url     = base64_decode($_get[return_url]); //get return url
foreach ($_session[products] as $cart_itm) //loop through session array var  
    {  
        if($cart_itm[code]!=$product_code){ //item does,t exist in the list  
            $product[] = array('name'=>$cart_itm[name], 'code'=>$cart_itm[code], 'qty'=>$cart_itm[qty], 'price'=>$cart_itm[price]);  
        }
//create a new product list for cart  
        $_session[products] = $product;  
    }
//redirect back to original page  
    header('location:'.$return_url);  
}  
?>
回复讨论(解决方案) 你的表单没有提交按钮,且没有给出通过 js 提交的代码
所以任何浏览器都不可能产生表单提交动作
你的表单没有提交按钮,且没有给出通过 js 提交的代码
所以任何浏览器都不可能产生表单提交动作
解决了,是submit的事
三明分类信息网,免费分类信息发布

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product