Re: Checkboxes to gather rows to delete

From: Date: Tue, 25 Feb 2003 21:34:32 +0000
Subject: Re: Checkboxes to gather rows to delete
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-25917@lists.php.net to get a copy of this message
----- Original Message ----- From: "Lewis Watson" <php@visionsix.com> To: <php-db@lists.php.net> 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 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\">";

« previous php.db (#25917) next »