Assuming you have an artificial key for your table (like an auto increment
column), I would place the key field to the table on your form in the value
of the checkbox;

<input type=checkbox name="recsel[]" value="$rowid">

When the form is returned to your "post" php script it will only receive
those checkboxes that are checked and they will come loaded in an array
(because of the way the name is described, containing the [] characters);

$selarray = $_POST["recsel"];

If(is_array($selarray)) $query = "select * from datatable where tblkey in
(".implode(", ",$selarray).") ";
Else echo "nothing selected";  // even an array containing one occurrence is
sufficient.

I believe all this is correct.  Good luck,

Warren Vail


-----Original Message-----
From: Todd Cary [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, November 02, 2004 1:38 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Passing marked rows in a table


I create a list of records from a DB and each has a check box.  What is 
the best way to select those that were checked after the form is submitted?

Todd

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

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

Reply via email to