i have a page which list all the products and there are checkbox to do muiltiple deletion. but there is an error on line 62 for the $delete

<html>
<head>
<title>delete</title>
</head>
<body>
<?
$objConnect = mysql_connect("localhost","root","booo33384") or die(mysql_error());
$objDB = mysql_select_db("db-test");
//$strSQL = "SELECT * FROM products3";
$strSQL = "SELECT * FROM products4";
$result=mysql_query($strSQL);
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
?>
<table width="600" border="1">
  <tr>
    <th width="91"> <div align="center">ID </div></th>
    <th width="98"> <div align="center">Title </div></th>
        <th width="98"> <div align="center">Author </div></th>
           <th width="98"> <div align="center">ISBN </div></th>
            <th width="98"> <div align="center">Description </div></th>
                <th width="98"> <div align="center">Publisher </div></th>
                    <th width="98"> <div align="center">Year </div></th>
                        <th width="98"> <div align="center">Stock Avaliable </div></th>
                            <th width="98"> <div align="center">Price </div></th>
                                <th width="98"> <div align="center">Sold </div></th>
    <th width="198"> <div align="center">Category Name </div></th>
    <th width="97"> <div align="center">Image </div></th>
    <th width="97"> <div align="center">Update </div></th>
        <th width="97"> <div align="center">Delete </div></th>
  </tr>
<?
while($objResult = mysql_fetch_array($objQuery))
{
//  $img_name = $row['img'];
    //    $image = "'site_images/$img_name'";
?>
  <tr>
    <td><div align="center"><?=$objResult["productid"];?></div></td>
    <td><?=$objResult["title"];?></td>
     <td><?=$objResult["author"];?></td>
      <td><?=$objResult["isbn"];?></td>
       <td><?=$objResult["description"];?></td>
        <td><?=$objResult["publisher"];?></td>
         <td><?=$objResult["year"];?></td>
          <td><?=$objResult["stock"];?></td>
           <td><?=$objResult["price"];?></td>
            <td><?=$objResult["sold"];?></td>
    <td><?=$objResult["categoryname"];?></td>
   
    <td><div align="center"><img src="site_images/<?=$objResult["img"];?>" width="150" height="250"></div></td>
        <td><div align="center"><a href="update.php?id=<?=$objResult["productid"];?>">update</a></div></td>
        <td align="center" bgcolor="#FFFFFF"><input name="checkbox[]" type="checkbox" id="checkbox[]" value="<?=$objResult["productid"];?>"></td>
  </tr>
<?
}
?>
<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($delete){
for($i=0;$i<$count;$i++){
$del_id = $checkbox[$i];
$sql = "DELETE FROM productsid WHERE id='$del_id'";
$result = mysql_query($sql);
}

// if successful redirect to delete_multiple.php 
if($result){
echo "<meta http-equiv=\"refresh\" content=\"0;URL=admin-list-products.php\">";
}
}
?>
</table>



<?
mysql_close($objConnect);
?>
</body>
</html>

$delete is never given a value.

That's because $delete doesn't exist.
but you got bigger problems:
you cant just use <input > , it must be inside a <form >
http://www.w3schools.com/tags/tag_form.asp
to link back to you script

<form action="<?php echo($_SERVER['PHP_SELF']); ?>" method="get">

your form values will be in $_GET
change your if to

if ($_GET['delete']) {

That's because $delete doesn't exist.
but you got bigger problems:
you cant just use <input > , it must be inside a <form >
http://www.w3schools.com/tags/tag_form.asp
to link back to you script

<form action="<?php echo($_SERVER['PHP_SELF']); ?>" method="get">

your form values will be in $_GET
change your if to

if ($_GET['delete']) {

thanks.but i tried, still the same error.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.