Re: Checkboxes to gather rows to delete

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



----- Original Message -----
From: "Lewis Watson" <php@visionsix.com>
To: <php-db@lists.php.net>
Sent: Monday, February 24, 2003 9:35 AM
Subject:  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
table
> 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.
Lewis

// 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[]\"
value=\"$row[teacherID]\">";

 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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux