Here is the code i use to delete multiple items
<?php
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private");
session_start();
header("Cache-control: private"); //IE bug Fix
//Begin PHP file adetail.php
if(!@$_SESSION['name'])
header("location: logout.php");
$host = "localhost";
$user = "scott";
$pass = "tiger";
$dbname = "bosssyst";
$connection = mysql_connect($host,$user,$pass) or die (mysql_errno().": ".mysql_error()."<BR>");
mysql_select_db($dbname);
$sql = "select * from quotation";
$result=mysql_query($sql);
$count=mysql_num_rows($result);
?>
<style>
.tab{font-family:verdana;font-size:12}
</style>
<center>
<table width="600" border="0" cellspacing="0" cellpadding="2">
<tr>
<td><form name="form1" method="post" action="">
<table width="600" border="0" cellpadding="6" cellspacing="1" bgcolor="#CCCCCC" class=tab>
<tr bgcolor=lightblue>
<td colspan="6" align=center><strong>Admin Control Panel</strong> </td>
</tr>
<tr bgcolor=#6495ed>
<td align="center" >#</td>
<td align="center" ><strong> Name</strong></td>
<td align="center" ><strong>Date</strong></td>
<td align="center" ><strong>Quotation No:</strong></td>
<td align="center" ><strong>Password</strong></td>
</tr>
<?php
echo '<form action="" method=post>';
for($i = 0; $i < $count; $i++) {
$rows = mysql_fetch_array($result);
if($i % 2) {
echo "<TR bgcolor=\"#f0f8ff\">\n";
} else {
echo "<TR bgcolor=\"#faebd7\">\n";
}
echo '<TD><input name="checkbox[]" type=checkbox value='.$rows['id'].'></td>';
echo"<td align=center>".$rows['name']."</td>";
echo"<td align=center>". $rows['date']."</td>";
echo"<td align=center>".$rows['quotationno']."</td>";
echo"<td align=center>".$rows['password']."</td>";
echo"<td align=center>".$rows['id']."</td>";
echo "</tr>\n";
}
echo "</TABLE>\n";
?>
<tr>
<td colspan="5" align="center" bgcolor="#FFFFFF"><input name="delete" type="submit" id="delete" value="Delete"></td>
</tr>
<?
// Check if delete button active, start this
if(isset($_POST['delete'])&& isset($_POST['checkbox']) ){
for($i=0;$i<$count;$i++){
$del_id = $checkbox[$i];
$sql = "DELETE FROM quotation WHERE id='$del_id'";
$result = mysql_query($sql);
}
// if successful redirect the same page
if($result){
echo "<meta http-equiv=\"refresh\" content=\"0;URL=adetail.php\">";
}
}
echo '</form>';
mysql_close();
?>
</table>
</form>
</td>
</tr>
</table>
I am getting error undefined variable checkbox and the rows are not getting deleted please help