在火狐下,PHP程序 在下订单时,更改了产品数量,但单价与数量相乘后,计算出来总价是错的.在IE下,是正常,怎么办
解决方案 »
- 再问一个正则,不好意思
- php源码IE下乱码,Firefox不是乱码,请大家帮忙看看。
- 重写 二级域名
- 为什么滚顿效果只持续了两三分钟,自己就停了
- 我想学PHP有什么书好介绍下??
- 谁能让我的PHP连上MYSQL,我就给他100分
- 新人学习PHP问题,发现书上代码不对
- 哪位能共享一个zip类?可以压缩和解压的
- select a.facctcode from a2005001laccount a ,a2005001fcwvch b where a.facctcode=*b.fkmh *在这里有什么作用?
- 我是php程序运行时出现了这样的结果 请各位帮忙看一下出了什么问题
- PHP 怎么防盗链接打开页面?
- 急啊,大吓进来看看!在线等
if($_REQUEST["act"]=="gx")
{
$pid=explode(',',$_REQUEST["allcheckboxs"]);for($i=0;$i<count($pid);$i++)
{
$bnum=$_REQUEST["carnumber".$pid[$i]];
$sql="update shop_cart set carnumber=$bnum where id=$pid[$i]";
$sql2="update shop_cart set total=carnumber*productprice where id=$pid[$i]";
$result=$db->query($sql,$conn);
$result2=$db->query($sql2,$conn);
}
echo"<script>location.href='cart_list.php'</script>";
}
<?
@session_start();
require('system/inc/db_conn.php');
require('inc/pageft.php');
$conn = $db->conn_open();
if($_SESSION["login_status"]==""|| $_SESSION["login_status"]== false)
{
echo("<script>alert('Please Register or Login ');history.go(-1)</script>");
}
?>
<?
if($_REQUEST["act"]=="del")
{$id = $_REQUEST['id'];
$sql = "delete from shop_cart where id='$id'";
$result = $db->query($sql,$conn);
if($result){
echo("<script>location.href='cart_list.php'</script>");
}else{
echo("<script>alert('Delete Failure');location.href='cart_list.php'</script>");
}}if($_REQUEST["act"]=="gx")
{
$pid=explode(',',$_REQUEST["allcheckboxs"]);for($i=0;$i<count($pid);$i++)
{
$bnum=$_REQUEST["carnumber".$pid[$i]];
$sql="update shop_cart set carnumber=$bnum where id=$pid[$i]";
$sql2="update shop_cart set total=carnumber*productprice where id=$pid[$i]";
$result=$db->query($sql,$conn);
$result2=$db->query($sql2,$conn);
}
echo"<script>location.href='cart_list.php'</script>";
}
?>
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<LINK href="images/css.css" type=text/css rel=stylesheet>
<title>Shopping Cart</title>
<script language="javascript">
function allcheckbox()
{
myform.allcheckboxs.value = "";
if ( !myform.checkbox1.length ) // 只有一个复选框,form3.checkbox1.length = undefined
{
if ( myform.checkbox1.checked )
myform.allcheckboxs.value = myform.checkbox1.value;
}
else
{
for ( i = 0 ; i < myform.checkbox1.length ; i++ )
{
if ( myform.checkbox1(i).checked ) // 复选框中有选中的框
{
myform.allcheckboxs.value = myform.checkbox1(i).value;
for ( j = i + 1 ; j < myform.checkbox1.length ; j++ )
{
if ( myform.checkbox1(j).checked )
{
myform.allcheckboxs.value += ","; //用,做分割符
myform.allcheckboxs.value += myform.checkbox1(j).value;
}
}
break;
}
}
} return true; }</script>
</head><body>
<?require"top.php";
?>
<table width="948" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="248" height="4"></td>
<td width="3"></td>
<td width="697"></td>
</tr>
<tr>
<td rowspan="2" valign="top">
<? require("left.php");?>
</td>
<td> </td>
<td rowspan="5" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="697" height="25" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" background="images/goods_head.gif">
<!--DWLayoutTable-->
<tr>
<td width="12" height="25"> </td>
<td width="680" align="left" valign="middle" class="leftmenu">Shopping Cart</td>
<td width="5"></td>
</tr>
</table></td>
</tr>
<tr><form action="?act=gx" method="post" name="myform" id="myform" onsubmit="allcheckbox()">
<td height="459" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="bian3">
<!--DWLayoutTable-->
<tr>
<td height="51" colspan="6" align="left" valign="top" style="border-bottom:2px #e3e3e1 dotted;"><img src="images/cartnavi-1.gif" width="599" height="49" /></td>
</tr> <tr>
<td height="25" colspan="6" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" background="images/2menubg.gif">
<!--DWLayoutTable-->
<tr>
<td width="131" height="25" align="center" valign="middle"><strong>Photo</strong></td>
<td width="193" align="center" valign="middle">Product Name</td>
<td width="126" align="center" valign="middle">Price($)</td>
<td width="117" align="center" valign="middle">Amount</td>
<td width="89" align="center" valign="middle">Subtotal</td>
<td width="39"> </td>
</tr>
</table></td>
</tr>
<?
$sql="select c.*,p.Class_photoa,p.sortid from shop_cart c,sq_class p where class_id=productid and userid =".$_SESSION['user_id']." and ordertype=1";
$result=$db->query($sql,$conn);
$row=$db->num_rows($result);
$tmoney=0;
for ($i=0;$i<$row;$i++){
$rs=$db->fetch_array($result,MYSQL_BOTH);
$tmoney=$tmoney+$rs["total"];
?>
<tr>
<td width="130" height="160" valign="top"><img src="<?=$rs["Class_photoa"]?>" width="130" height="160" border="0" /></td>
<td width="196" align="center" valign="middle"> <input name="checkbox1" type="checkbox" id="checkbox1" value="<?=$rs["id"]?>" checked="checked" style="display:none"/><?=$rs["productname"]?></td>
<td width="123" align="center" valign="middle"><?=$rs["productprice"]?></td>
<td width="116" align="center" valign="middle"><label>
<input name="carnumber<?=$rs["id"]?>" type="text" class="textf" id="carnumber" value="<?=$rs["carnumber"]?>" size="4" maxlength="4"/>
</label></td>
<td width="87" align="center" valign="middle"><?=$rs["total"]?></td>
<td width="43" align="center" valign="middle"><a href="?act=del&id=<?=$rs["id"]?>"><img src="images/b-delete.gif" width="39" height="22" border="0" /></a></td>
</tr>
<?
}
?>
<tr>
<td height="127" colspan="6" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" style="border-top:2px #d2eafc solid;">
<!--DWLayoutTable-->
<tr>
<td width="285" height="50"> </td>
<td width="58"> </td>
<td width="352" align="right" valign="bottom" class="Price"><strong>Subtotal:<?=$tmoney?>
$</strong></td>
</tr>
<tr>
<td height="29"> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td height="47"><!--DWLayoutEmptyCell--> </td>
<td align="right" valign="middle"><!--DWLayoutEmptyCell--> </td>
<td align="right" valign="middle"><a href="Products.php"><span class="productListing-data">
<input name="allcheckboxs" type="hidden" />
</span><img src="images/cart_continue.gif" width="103" height="23" border="0" /></a>
<input type="image" src="images/cart_change.gif" name="Submit" value="提交" />
<a href="cart3.php"><img src="images/cart_next.gif" width="103" height="23" border="0" /></a></td>
</tr>
</table></td>
</tr>
<tr>
<td height="69"> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table></td>
</form>
</tr>
</table></td>
</tr>
</table>
<? require"end.php";?>
总结一下就是,在firefox不能改变产品数量
到现在还不知道是什么原因...............