-
سبد خريد!!!!
سلام كيست مرا ياري كند؟
يه سبد دارم با سشن درست كردم.وقتي چك باكسش ميكنم وارد سبد نميشه .كي ميتونه كمكم كنه.توروخدا پروژه ام برا همين يه تيكه رو هواست[HTML]<?php
$_price=0;
if(isset($_POST['ad']))
{ echo "<table border='0px' cellpadding='0px' cellspacing='5px' bgcolor='#FFF' bordercolor='#ccc'><tr bgcolor='#000' align='center'><th>حذف شدن</th><th>نام کالا</th><th>تصویر</th></tr>";
foreach($_POST['ch'] as $k=>$v)
{$_SESSION['sabad'][]=$v;}
/*foreach($_POST['ch'] as $k=>$v)
{ if(empty($_SESSION['sabad']))
{$_SESSION['sabad'][]=$v;}
else {for($j=0;$j<count($_SESSION['sabad']);$i++)
if($_SESSION['sabad'][$j]!=$v)
$_SESSION['sabad'][]=$v;
}*/
/*--------------------------------------------------------------------*/
foreach($_SESSION['sabad'] as $k=>$v)
{$sabad=find("mahsolat",array('id'=>$_SESSION['sabad'][$k]));
echo"<tr align='center'>";
echo "<td><a href=del_sabad.php?id=",$k,"><img width='20' src='./upload/delete.png'></a></td>";
echo "<td>".$sabad['name']."</td>";
echo "<td><img width=25 height=30 src='./upload/".$sabad['pic']."' /></td>";
echo"</tr>";
$_price=$_price+$sabad['gheymat'];
}
echo "<tr bgcolor='#0000FF' align='center'><td>تومان</td><td>".$_price."</td><td>:قیمت</td></tr>";
echo "</table>";?>
<div style="width:158px; height:26px;background-color:#FC6;margin-left:0px;margin-right:5px;border-radius:8px;border-bottom-style:solid;border-top-style:solid;border-color:#400000;margin-top:1px;text-align:center;">
<?php echo "<a href=sabte_sefaresh.php><img width '159' height='26' src='./upload/end_kharid.png' /></a>" ?></div>
<?php }
/*-------------------------------------------------------------------------------*/
/*for($i=0;$i<count($_SESSION['sabad']);$i++)
{
$sabad=mysql_query("select * from mahsolat where id='{$_SESSION['sabad'][$i]}'",$conn) or die(mysql_error());
$re=mysql_fetch_array($sabad);
echo"<tr align='center'>";
echo "<td><a href=del_sabad.php?id=",$rec['id'],"><img width='20' src='../upload/delete.png'></a></td>";
echo "<td>".$re['name']."</td>";
echo "<td><img width=25 height=30 src='../upload/".$re['pic']."' /></td>";
echo"</tr>";
}
echo "</table>";
}*/
/* print_r($_SESSION['sabad']);*/
/*-------------------------------------------------------------------------------*/
else
{ if(!empty($_SESSION['sabad']))
{
echo "<table border='0px' cellpadding='0px' cellspacing='5px' bgcolor='#FFF' bordercolor='#ccc'><tr bgcolor='#000' align='center'><th>حذف شدن</th><th>نام کالا</th><th>تصویر</th></tr>";
foreach($_SESSION['sabad'] as $k=>$v)
{$sabad=find("mahsolat",array('id'=>$_SESSION['sabad'][$k]));
echo"<tr align='center'>";
echo "<td><a href=del_sabad.php?id=",$k,"><img width='20' src='../upload/delete.png'></a></td>";
echo "<td>".$sabad['name']."</td>";
echo "<td><img width=25 height=30 src='../upload/".$sabad['pic']."' /></td>";
echo"</tr>";
$_price=$_price+$sabad['gheymat'];
}
echo "<tr bgcolor='#0000FF' align='center'><td>تومان</td><td>".$_price."</td><td>:قیمت</td></tr>";
echo "</table>";?>
<div style="width:158px; height:26px;background-color:#FC6;margin-left:0px;margin-right:5px;border-radius:8px;border-bottom-style:solid;border-top-style:solid;border-color:#400000;margin-top:1px;text-align:center;">
<?php echo "<a href=sabte_sefaresh.php><img width='159' height='26' src='./upload/end_kharid.png' /></a>" ?></div>
<?php }
else echo".سبد خرید خالی است";
}
?>[/HTML]