You best bet is to do this:

List all your rows with the ID to delete in the NAME of the checkboxes and
at the same time build a list seperated by "," with your IDs so you can use
that list the EXPLODE function for PHP:

Echo "<input type=\"checkbox\" name=\"id" . $row[id] . "\" value=\"1\">";
$idList .= $sep . $row[id];
$sep = ","

This little snippet is used to draw your list of checkboxes, the other lines
are used to build a list of IDs in the form of:

When this step is done, at the bottom of your form, draw a hidden field with
the list of IDs as the value

Echo "<input type=\"hidden\" name=\"idlist\" value=\"$idList\">"

Then in THE OTHER SCRIPT, the one used to delete
you can explode the list of Ids and loop the array to get all values the
user checked:

$array_id = explode("," $idlist");
foreach($array_id as $id){
    if(${"id" . $id} == 1){
        //INSERT YOUR CODE TO DELETE HERE, the id to to delete is in $id

The ${"id" . $id}is a way to get a variable by it's name even if you don't
know it, all thats inside the {} are considered the variable name. Then
check if that variable contains 1 or "". 1 meaning it was checked and ""
meaning it wasn't

Have a nice day
Mathieu Dumoulin
Web solutions programmer analyst

"Lewis Watson" <[EMAIL PROTECTED]> a écrit dans le message de news:
> 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

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to