Hi everyone,

I am working on one application in which i am using many checkboxes for many records like we use in our mail .
Like in our inbox mail folder if we want to delete more than one mail , after checking that mail in checkbox , we click on delete selected mail button , it deletes that mail.

Like this i want to use this type of checkbox in for everyproduct and when we click on checkboxes.

I will let you know the format for this-----------

1. product info checkbox
2.product info checkbox
3.product info checkbox
here is one button "delete selected"

now i want that when i will click on delete selected button , i can delte that all records which i have selected from checkboxes
ALL this i want to delete that records from database. and all should be in php,html and mysql query.

so please help me . i have written all code of this problem is that it is not working still.


8 Years
Discussion Span
Last Post by rm_daniweb

Hi everyone,

I want to use php code as like our mail application we delete all selected mail in our mailbox which one we have select through checkboxes.

I am posting code of my addlink.php file. Please help me. It is very urgent for me.







//echo $a;





$sql1="select Url,Title from addlink where Url='".$_POST['url']."' or Title='".$_POST['title']."'";





$sql="insert into addlink(ID,cat_ID,Url,description,Title,Name,Email,date)


if (!mysql_query($sql,$link))


  die('Error: ' . mysql_error());



$sql6 = mysql_query("delete FROM description where ID='".$_POST['id']."'");

$msg="Record Is Submitted";



$subject="Link Submission Confirmation";

$massage="Hello ".$_POST[name].",<br><br><br> Your link Submission request has been approved on 


<br><br><br><b>We submit your link on page</b> 		   



and Regard<br>Support Team<br>huntor.org<br><br> &nbsp;info@huntor.org";

  $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

	         $headers .='From:huntor' . "\r\n";





//$sql6 = mysql_query("delete FROM description where cat_ID='".$_POST['cat_id']."'");
$sql6 = mysql_query("delete FROM description where ID='".$_POST['id']."'");

$msg="Record Deleted";



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">



<title>Untitled Document</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<script language="javascript" src="../javascript/cal2.js"></script>

<script language="javascript" src="../javascript/cal_conf2.js"></script>

<link href="../css/cascading.css" rel="stylesheet" type="text/css">



<table width="100%"  border="0" cellspacing="0" cellpadding="0">


    <td width="23%" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">





    <? include_once("left_menu.php");?></td>

    <td width="77%"><table width="100%"  border="0" cellspacing="0" cellpadding="0">


        <td><form action="addlink.php" method="post" name="formdate">

         <select name="category" class="footerlink" >

            <option value="0" selected>ALL</option>

			 </option><? $sql2="select * from tbl_cat where sub_cat_id='0' order by cat_name asc";




                      <option  value="<?=$row2[0]?>"><?=$row2[2]?> </option>

					  <?  $cat_id=$row2[0];

					   $sql5="select * from tbl_cat where sub_cat_id='$cat_id' order by cat_name asc";


					   while($row5=mysql_fetch_array($query5)){ ?>

                      <option  value="<?=$row5[0]?>"> |_<?=$row5[2]?></option><? } } ?>


         <input type="text" name="firstinput" size=20 class="footerlink" value="<? echo $_SESSION['firstinput']?>" readonly>      

         <small><a href="javascript:showCal('Calendar1')" class="redfont">Select Date</a> <input type="text" name="secondinput" size=20 class="footerlink" value="<? echo $_SESSION['secondinput']?>" readonly>		        

         <small><a href="javascript:showCal('Calendar2')" class="redfont">Select Date</a></small>

          <input name="Submit8" type="submit" class="footerlink" value="Submit">




        <td align="center" class="count"><?=$msg?></td>


	  $rowsPerPage =25;

// by default we show first page

$pageNum = 1;

// if $_GET['page'] defined, use it as page number



    $pageNum = $_GET['page'];


// counting the offset

$offset = ($pageNum - 1) * $rowsPerPage;

if($_POST['category']==0){ //echo "hi";

$query = " SELECT * FROM description where date between '".$_SESSION[firstinput]."'

AND '".$_SESSION[secondinput]."' order by ID asc LIMIT $offset, $rowsPerPage"; }



$query = " SELECT * FROM description where cat_ID='".$_POST['category']."' and date between '".$_SESSION[firstinput]."'

AND '".$_SESSION[secondinput]."' order by ID asc LIMIT $offset, $rowsPerPage"; }

$result = mysql_query($query) or die('Error, query failed789');

<form action="addlink.php" method="post" name="form1">
// print the random numbers

while($row = mysql_fetch_array($result))



      <tr><td><table width="100%"  border="1" cellspacing="0" cellpadding="0">


            <td width="76%"><? echo "<span class=categorieslink>$row[Title]</span><br>";?><? echo "<span class=descriptiontext> $row[description]</span><br>";?><a href="<?=$row[Url]?>" target="_blank"><? echo "<span class=redfont>$row[Url]</span><br>";?></a><? echo "<span class=sidetxt> $row[Name]</span><br>";?><? echo "<span class=sidetxt> $row[Email]</span><br>";?> <? $sql01 = "Select * from tbl_cat where id=$row[cat_ID]";
$result01 = mysql_query($sql01,$link) or die('Error is '. mysql_error());
while($object= mysql_fetch_array($result01)) { 
//echo "<span class=sidetxt> $object[sub_cat_id]</span><br>"; 
if ($object['sub_cat_id'] == 0) {
echo "<span class=sidetxt> $cat</span><br>"; 
} else {

$sql02 = "Select * from tbl_cat where id=$object[sub_cat_id] and sub_cat_id=0";
$result02 = mysql_query($sql02,$link) or die('Error is '. mysql_error());
while($object2= mysql_fetch_array($result02)) { 
echo "<span class=sidetxt> $object2[cat_name]</span>"; }
echo "<span class=sidetxt>__$cat</span><br>";
} ?></td>

            <td width="12%" align="center"><input name="id" type="hidden" value="<?=$row['ID']?>"><input name="cat_id" type="hidden" value="<?=$row['cat_ID']?>"><input name="url" type="hidden" value="<?=$row['Url']?>"><input name="description" type="hidden" value="<?=$row['description']?>"><input name="title" type="hidden" value="<?=$row['Title']?>"><input name="name" type="hidden" value="<?=$row['Name']?>"><input name="email" type="hidden" value="<?=$row['Email']?>"><input name="Submit2" type="submit" class="footerlink" value="Submit"></td>

            <td width="12%" align="center"><input type="checkbox" name="<?=$row['ID']?>" value="1">&nbsp;




      </tr><? } ?> 
	  <td align="right" class=sidetext><input type="button" value="Delete Selected Links" name="dellink" class="footerlink"></td>




$query   = "SELECT COUNT(ID) AS numrows from description where date between '".$_SESSION[firstinput]."'

AND '".$_SESSION[secondinput]."' order by ID asc"; }



$query = " SELECT COUNT(ID) AS numrows from description where cat_ID='".$_POST['category']."' and date between '".$_SESSION[firstinput]."' AND '".$_SESSION[secondinput]."'  order by ID asc"; }


$result  = mysql_query($query) or die('Error, query failed124');

$row     = mysql_fetch_array($result, MYSQL_ASSOC);

$numrows = $row['numrows'];

// how many pages we have when using paging?

$maxPage = ceil($numrows/$rowsPerPage);

// print the link to access each page


$nav  = '';

for($page = 1; $page <= $maxPage; $page++)


   if ($page == $pageNum)


      $nav .= " $page "; // no need to create a link to current page




      $nav .= " <a href=\"$self?page=$page\" class=text_1>$page</a> ";



if ($pageNum > 1)


   $page  = $pageNum - 1;

   $prev  = " <a href=\"$self?page=$page\" class=text_1>[Prev]</a> ";

   $first = " <a href=\"$self?page=1\" class=text_1>[First Page]</a> ";




   $prev  = ' '; // we're on page one, don't print previous link

   $first = ' '; // nor the first page link


if ($pageNum < $maxPage)


   $page = $pageNum + 1;

   $next = " <a href=\"$self?page=$page\" class=text_1>[Next]</a> ";

   $last = " <a href=\"$self?page=$maxPage\" class=text_1>[Last Page]</a> ";




   $next = ' '; // we're on the last page, don't print next link

   $last = ' '; // nor the last page link


// print the navigation link


echo "<span class=sidetext>Pages :</span>";}echo"<span class=text_1> $first  $prev  $nav  $next  $last</span>"; 








Hi please help me to for this i can delete all select records with using button delete all links.


This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.