User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 427,037 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,507 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting

How to delete using checkboxes

Join Date: Dec 2006
Posts: 34
Reputation: php_coder is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
php_coder php_coder is offline Offline
Light Poster

Solution Re: How to delete using checkboxes

  #11  
Dec 18th, 2006
Originally Posted by zed420 View Post
I've tried it mate didn't quite work but some thing did work here it is

hi buddy
The mistake in ur code i think is this
<TD ALIGN=CENTER ><input type="checkbox" name="<?=$row[id]?>" id="<?=$row[id]?>" value="<?=$row[id]?>"/></TD>

Give the name as this: name="<?='checkme[]';?>" where checkme[] is the nameof the checkbox.Do not hv to assign value in the name parameter
catch the value of checkbox as $checklist = $_POST["checkme"];
Then loop it through......
for($i=0; $i<count($checklist); $i++)
{
echo "print";
$remove = $checklist[$i];
$query=mysql_query("DELETE FROM materialmaster WHERE material_code='$remove'");// Notice that i am deleting using the checkbox var $remove
}
That's it. make these changes......sure it will work.gudluck
Last edited by php_coder : Dec 18th, 2006 at 5:35 am.
Reply With Quote  
All times are GMT -4. The time now is 3:03 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC