this is d code:
nothing happens when i check d checkbox n click delete button..pls rep as soon as psble n i'l b realy thnkful..
i need to store the content in trash table b4 deleting frm inbox..bt nothig of d two z hppng..
Code:
<html>
<body>
<?php
$dbhost='localhost';
$dbuser='root';
$dbpass='';
$db='country1';
$connection=mysql_connect($dbhost,$dbuser,$dbpass) or die("unable to connect");
mysql_select_db($db) or die("unable to select");
session_start();
$_SESSION['userid']=$_COOKIE['userid'];
$q=$_SESSION['userid'];
$query="select * from inbox where receiverid='$q' GROUP BY (id) DESC";
$result=mysql_query($query);
if(!isset($_POST['submit']))
{
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<?php
if(mysql_num_rows($result)>0)
{
echo"<table border=0 cellpadding=0 cellspacing=0>";
while($row=mysql_fetch_row($result))
{
echo "<tr>";
echo "<td><input type='checkbox' name='chk1[]' value='' ></td>";
echo "<td><a href='abc.php?id=$row[0]'>$row[1] $row[2] $row[3]</a></td>";
echo "</tr>";
}
echo "</table>";
}
?>
<input type="button" name="submit" value="delete">
</form>
<?php
}
else
{
$dbhost='localhost';
$dbuser='root';
$dbpass='';
$db='country1';-
$connection=mysql_connect($dbhost,$dbuser,$dbpass) or die("unable to connect");
mysql_select_db($db) or die("unable to select");
$c=$_POST['id'];
if (sizeof(id)>0)
{
foreach($c as $ca)
{
$query="select * from inbox where id='$ca'";
$result=mysql_query($query);
if(mysql_num_rows($result)>0)
{
while($row=mysql_fetch_row($result))
{
$q="insert into trash (inboxid,senderid,receiverid,subject,message,mdate) values ('$row[0]','$row[1]','$row[2]','$row[3]','$row[4]','$row[5]')";
}
$q1="delete * from inbox where id='$ca'";
}
}
}
}
?>
</body>
</html>
i need to store the content in trash table b4 deleting frm inbox..bt nothig of d two z hppng..