----- Original Message -----
From: "Lewis Watson" <[EMAIL PROTECTED]>
Sent: Monday, February 24, 2003 9:35 AM
Subject: [PHP-DB] Checkboxes to gather rows to delete

> I have a mysql database with a table using one column as a primary key.
> (rowID). On a php page I use a query to  list all of the rows of the
> and have a checkbox beside each  row that should be used to check if you
> would like to delete this row. Can someone give me an example using post
> to pull the boxes that need to be deleted.
> Thanks!
> Lewis

I appreciate everyones help. Below what I ended up with to actually delete
the checked boxes.

// Deletes specified rows by teacherID.
        if(isset($delete_teacher) && isset($deleteID)) {

                while (list($key, $num)= each($_POST[deleteID])){

                            $delete_query = mysql_query("delete from
teacher where teacherID = $num");
                            print $delete_query;
                            print "<br>";

//Checkbox and Submit lines...
 print "<input type=checkbox name=\"deleteID[]\"

 print "<input type=submit  name=\"delete_teacher\"  value=\"Delete the
Checked Teachers\">";

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to