01-15-2008, 02:27 AM
|
#1 (permalink)
|
|
The Wanderer
Join Date: Nov 2007
Posts: 10
Thanks: 0
|
Multiple Checkbox problems
What I'm trying to do is delete items in a mysql database that are displayed with a simple checkbox. Here is the form that is generated.
Code:
<form action="" method="post">
sql query here
print"<input type="checkbox" class="delete-checkbox" value="{$row['id']}" name="deletebox[]" />";
<input type="submit" name="submit" value="delete messages" />
</form>
Here is the php that I'm using when its POSTED
Code:
if(isset($_POST['submit'])) {
foreach($_POST['deletebox'] as $deletebox1){
mysql_query("DELETE FROM private_messages WHERE id='$deletebox1'") or die(mysql_error());
}
}
However, nothing happens, which seems to be something with the array, but I can't figure it out. I've tried putting something to print out what is in the array that is passed, but it never prints anything out, like its blank. And I'm positive there are values in the deletebox[] value when you check it.
|
|
|
|