|
this is how i display the contents of the basket of the user...
--------------------------------
<?php
$x=0;
$total=0;
while($x<$num){
echo '<tr>';
$type=mysql_result($result,$x,'citemtype');
$item=mysql_result($result,$x,'cref');
$price=mysql_result($result,$x,'cprice');
$total=$total+$price;
echo '<td width="45" align="center" height="12"><b>';
echo '<font face="Verdana" size="1">'.$type.'</font></b></td>';
echo '<td width="131" align="center" height="12"><b>';
echo '<font face="Verdana" size="1">'.$item.'</font></b></td>';
echo '<td width="54" align="center" height="12"><b>';
echo '<font face="Verdana" size="1">'.$price.'</font></b></td>';
echo '<td width="98" align="center" height="12"><b>';
echo '<font face="Verdana" size="1"><a href="rem.php" style="text-decoration: none">remove</a></font></b></td>';
$x++;
}//end while
?>
---------------
this part is where the user would like to remove a certain item:
echo '<font face="Verdana" size="1"><a href="rem.php" style="text-decoration: none">remove</a>
now where should i place the $_GET here?
currently the contents of rem.php is these:
-------
<html>
<head>
</head>
<body>
<?php
session_start();
$user = $_SESSION['myuser'];
$conn=mysql_connect(.....) or die('server not found');
$db='mydb';
mysql_select_db($db) or die('.: database done exist :.');
$sel="delete from cart where cuser = '$user'";
$result=mysql_query($sel) or die('.: can\'t perform the query :.');
mysql_close();
?>
<script type="text/javascript">
window.location="basket.php";
</script>
</body>
</html>
since i dont know yet how to remove an item individually..i erase them all.
|