deleting all checked records

From: Date: Wed, 15 Nov 2000 17:24:29 +0000
Subject: deleting all checked records
Groups: php.general 
Request: Send a blank email to php-general+get-25472@lists.php.net to get a copy of this message
hello all, I have a page that displays the records of a table with a checkbox for each record. I want to delete all the checked records. The code is working fine if i check one record.But when i check more than one record i am not able to write the code. please help me. I am giving the code i have written. --------------------------------------------------------- <html> <head><title>sagar</title></head> <body> <form name=form1 action="del.php3" method="post"> <? $db=mysql_connect("localhost","root","idiot"); mysql_select_db("mydb",$db); $result=mysql_query("select * from sagar"); do{ $i++; $x=$myrow["id"]; echo "<input type=checkbox name=chk value=$x>"; echo $myrow["name"]; } while ($myrow=mysql_fetch_array($result)); ?> <input type=submit value="del"> </form> </body> </html> ---------------------------- del.php3 ----------------------------------- <html> <head><title>sagar</title></head> <body> <? $db=mysql_connect("localhost","root","idiot"); mysql_select_db("mydb",$db); mysql_query("delete from sagar where id='$chk';"); ?> </form> </body> </html> --------------------- Thank you sagar

« previous php.general (#25472) next »