php关于SESSION的问题. 我把网页分成俩个部分. 左侧全是图片 当我点击左侧图片 在右侧保存图片.. 当我点第二张图片 第一张图片扔在.第二张图片也能保存在上面..点第三张图片.前俩张仍然在.. 现在我出现的问题就是 点一张图片 就替换前面的图片的...请高手帮助解决呀... 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 上代碼,肯定是该+=写成=了或是js 该append写成=了 <?phpsession_start();$coon=mysql_connect("localhost","root","phpwind.net");mysql_select_db("caidan",$coon);mysql_query("set names gb2312");//error_reporting(0); $cid=$_GET[cid]; $images=$_GET[name]; $_SESSION[cid]=$cid; $_SESSION[images]=$images; /* echo '<pre>'; print_r($cai); echo '</pre>';echo '<hr />'; echo '<pre>'; print_r($_SESSION['images']); echo '</pre>';*/?><!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=gb2312" /><title>无标题文档</title></head><body><form id="form1" name="form1" method="post" action=""> <table width="184" border="1"> <tr> <?php$ck="select*from caidan";$ckl=mysql_query($ck);while($row=mysql_fetch_assoc($ckl)){ ?> <td width="174" align="center"><a href="tu.php?cid=<?php echo $row['id'] ?>&&&&&&name=<?php echo $row['images'] ?>"><img src="images/<?php echo $row[images] ?>.jpg" width="100" height="100" border="0" /></a></td> <?php $i++; if($i==2){ $i=0; echo "</tr>"; }} ?> </tr> </table></form> <?php$q="select*from caidan where id=$cid";$p=mysql_query($q);$rop=mysql_fetch_assoc($p); $name=$rop['images']; $cai=$_SESSION['cai']; $cai[$goods_id]=array('id'=>$cid,'images'=>$name);echo '<pre>'; print_r($cai[$goods_id]);echo '</pre>';$_SESSION['cai']=$cai; echo '<pre>'; //print_r($_SESSION['cai']);echo '</pre>'; ?><p> </p><table width="190" border="1"> <tr> <td width="189" align="center"><img src="images/<?php echo $images ?>.jpg" width="100" height="100" /></td> </tr></table></body></html> 我的心太乱啊本页是tu.php吗,点击后页面刷新了值都没了,就得到你传的一个src<table width="190" border="1"> <tr> <td width="189" align="center"><img src="images/<?php echo $images ?>.jpg" width="100" height="100" /></td> </tr></table>这儿你也没循环,就会一直是一条数据的你页面上好多session没用的,还有 print_r$q="select*from caidan where id=$cid";//你查过了,数据没用上啊你是不是想点左边图片,添加到右边表格里 请oscommerce高手帮忙关于quantity和price的问题 多张照片连接成全景照片 虎年到,拜年的来这里了!!! php网页编码转换问题! PHP+MySQL中文字符搜索 discuz7.2怎么防止垃圾贴 mysql 3306 端口 没法向外访问 PHP的语法错误,我找不出在哪错误! curl模拟登陆问题 PHP帮忙写一句代码 vmware安装问题 帝国采集
或是js 该append写成=了
session_start();
$coon=mysql_connect("localhost","root","phpwind.net");mysql_select_db("caidan",$coon);mysql_query("set names gb2312");//error_reporting(0); $cid=$_GET[cid];
$images=$_GET[name];
$_SESSION[cid]=$cid;
$_SESSION[images]=$images; /* echo '<pre>';
print_r($cai);
echo '</pre>';
echo '<hr />';
echo '<pre>';
print_r($_SESSION['images']);
echo '</pre>';*/
?>
<!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=gb2312" />
<title>无标题文档</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<table width="184" border="1">
<tr>
<?php
$ck="select*from caidan";
$ckl=mysql_query($ck);while($row=mysql_fetch_assoc($ckl)){
?>
<td width="174" align="center"><a href="tu.php?cid=<?php echo $row['id'] ?>&&&&&&name=<?php echo $row['images'] ?>"><img src="images/<?php echo $row[images] ?>.jpg" width="100" height="100" border="0" /></a></td>
<?php
$i++;
if($i==2){
$i=0;
echo "</tr>";
}
}
?> </tr>
</table>
</form> <?php
$q="select*from caidan where id=$cid";
$p=mysql_query($q);
$rop=mysql_fetch_assoc($p); $name=$rop['images'];
$cai=$_SESSION['cai'];
$cai[$goods_id]=array('id'=>$cid,'images'=>$name);
echo '<pre>';
print_r($cai[$goods_id]);
echo '</pre>';$_SESSION['cai']=$cai;
echo '<pre>';
//print_r($_SESSION['cai']);
echo '</pre>';
?><p> </p>
<table width="190" border="1">
<tr> <td width="189" align="center"><img src="images/<?php echo $images ?>.jpg" width="100" height="100" /></td> </tr>
</table>
</body>
</html>
本页是tu.php吗,点击后页面刷新了
值都没了,就得到你传的一个src
<table width="190" border="1">
<tr>
<td width="189" align="center"><img src="images/<?php echo $images ?>.jpg" width="100" height="100" /></td>
</tr>
</table>
这儿你也没循环,就会一直是一条数据的
你页面上好多session没用的,还有 print_r
$q="select*from caidan where id=$cid";//你查过了,数据没用上啊
你是不是想点左边图片,添加到右边表格里