[FX.php List] Getting checkbox array into FX/PHP

Edward L. Ford elford at cs.bu.edu
Sun Aug 20 20:49:43 MDT 2006


List,
I'm having a hard time getting a set of check box values to interface 
with my PHP class correctly.  From what I can tell, I'm not getting an 
array of values through POST; rather, I am getting only the value of the 
last box checked.

The check boxes on my form look like this:
<td><input class="req" name="inst[]" id="inst1" type="checkbox" 
value="Bassoon" />&nbsp;Bassoon</td>
<td><input class="req" name="inst[]" id="inst2" type="checkbox" 
value="Cello" />&nbsp;Cello</td>
<td><input class="req" name="inst[]" id="inst3" type="checkbox" 
value="Clarinet" />&nbsp;Clarinet</td>
<td><input class="req" name="inst[]" id="inst4" type="checkbox" 
value="Composer" />&nbsp;Composer</td>

My PHP script that handles the results of the POST has the following lines:
if(isset($_POST['inst']))
            $inst = implode($_POST['inst'],",");

PHP spits back a warning "*Warning*: implode(): Bad arguments. in 
*<server_path>/editentry-submit.php* on line *32"

When I tell PHP to print_r(*$_POST['inst']); I get only the value of the 
last value checked -- no other values.

How can I get the array of check box values?  Where am I going wrong?

All help is appreciated,
--Ed Ford


More information about the FX.php_List mailing list