2个回答
展开全部
最顶端开始session
<?php
session_start();
?>
<!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"><!-- InstanceBegin template="/Templates/temp.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>标题</title>
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" -->
<script type="text/javascript">
function changeCount(pno)
{
var result = document.getElementById("countt"+pno).value;
window.open("shopcar.php?pno="+pno+"&count111="+result, "_self");
}
</script>
<!-- InstanceEndEditable -->
<style type="text/css">
body
{
font-size:12px;
font-family:"新宋体";
text-align:center;
margin:0px;
bgcolor="#CCCCCC"
}
.yangshi
{
color:#6600CC;
float:left;
margin-top:1px;
font-family:"华文新魏";
font-size:18px;
}
a
{
color:blue;
font-size:18px;
font-family:"华文新魏";
text-decoration:none;
}
a:hover
{
text-decoration:underline;
}
a:visited
{
color:#6600CC;
text-decoration:none;
}
.a2
{
color:blue;
font-size:14px;
font-family:"隶书";
text-decoration:none;
}
</style>
</head>
<body bgcolor="#CCFFCC" style="text-align:center">
<!-- InstanceBeginEditable name="body" -->
<?php
if($_REQUEST[pno])
{
$cart[$_REQUEST[pno]][2]=$_REQUEST[count111];
}
?>
<form action="shopcar.php" method="post" name="form1">
<table border="1" border="1px" width="550px">
<tr><td>书名</td><td>价格</td><td>数量</td><td>此商品总价格</td><td>确定</td><td>操作</td></tr>
<?php
$cart=$_SESSION[cart];
$money=0;
$zongjia=0;
if(isset($cart))
{
foreach($cart as $bno=>$row)
{
$money=$row[1]*$row[2];
echo "<tr>
<td>".$row[0]."</td>
<td>".$row[1]."</td>
<td><input name=\"countt".$bno."\" type=\"text\" size=\"6\" value=\"".$row[2]."\"></td>
<td><input name=\"price\" type=\"text\" value=\"".((float)($row[1])*(float)($row[2]))."\" size=\"6\" readonly></td>
<td><input name=\"confirm\" type=\"button\" value=\"确定\" onClick=\"changeCount(".$bno.")\"/></td>
<td><a href=shopcar-middle.php?action=deletefromcart&bno=".$bno.">删除</a></td>
</tr>";
$zongjia+=$money;
}
}
$_SESSION[zongjia]=$zongjia;
?>
</table>
</form>
<a href="order.php">结账</a>
<a href="books.php">继续购物</a>
<!-- InstanceEndEditable -->
</body>
<!-- InstanceEnd --></html>
<?php
session_start();
?>
<!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"><!-- InstanceBegin template="/Templates/temp.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>标题</title>
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" -->
<script type="text/javascript">
function changeCount(pno)
{
var result = document.getElementById("countt"+pno).value;
window.open("shopcar.php?pno="+pno+"&count111="+result, "_self");
}
</script>
<!-- InstanceEndEditable -->
<style type="text/css">
body
{
font-size:12px;
font-family:"新宋体";
text-align:center;
margin:0px;
bgcolor="#CCCCCC"
}
.yangshi
{
color:#6600CC;
float:left;
margin-top:1px;
font-family:"华文新魏";
font-size:18px;
}
a
{
color:blue;
font-size:18px;
font-family:"华文新魏";
text-decoration:none;
}
a:hover
{
text-decoration:underline;
}
a:visited
{
color:#6600CC;
text-decoration:none;
}
.a2
{
color:blue;
font-size:14px;
font-family:"隶书";
text-decoration:none;
}
</style>
</head>
<body bgcolor="#CCFFCC" style="text-align:center">
<!-- InstanceBeginEditable name="body" -->
<?php
if($_REQUEST[pno])
{
$cart[$_REQUEST[pno]][2]=$_REQUEST[count111];
}
?>
<form action="shopcar.php" method="post" name="form1">
<table border="1" border="1px" width="550px">
<tr><td>书名</td><td>价格</td><td>数量</td><td>此商品总价格</td><td>确定</td><td>操作</td></tr>
<?php
$cart=$_SESSION[cart];
$money=0;
$zongjia=0;
if(isset($cart))
{
foreach($cart as $bno=>$row)
{
$money=$row[1]*$row[2];
echo "<tr>
<td>".$row[0]."</td>
<td>".$row[1]."</td>
<td><input name=\"countt".$bno."\" type=\"text\" size=\"6\" value=\"".$row[2]."\"></td>
<td><input name=\"price\" type=\"text\" value=\"".((float)($row[1])*(float)($row[2]))."\" size=\"6\" readonly></td>
<td><input name=\"confirm\" type=\"button\" value=\"确定\" onClick=\"changeCount(".$bno.")\"/></td>
<td><a href=shopcar-middle.php?action=deletefromcart&bno=".$bno.">删除</a></td>
</tr>";
$zongjia+=$money;
}
}
$_SESSION[zongjia]=$zongjia;
?>
</table>
</form>
<a href="order.php">结账</a>
<a href="books.php">继续购物</a>
<!-- InstanceEndEditable -->
</body>
<!-- InstanceEnd --></html>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询