Justtechjobs.com Find a programming school near you






Online Campus Both


php3-list | 199807

Re: [PHP3] arrays using check boxes From: Rasmus Lerdorf (rasmus <email protected>)
Date: 07/02/98

> I have just started using PHP3. I have been using mSQL lite as my
> scripting language. I have a page that has checkboxes. Each checkbox
> has the same name, but different values. When using mSQL lite, the
> check box values are stored in the array (name of the the check box)
>
> <input TYPE=checkbox NAME="subckb" VALUE="ACCIDENTS (GENERAL)">
> <input TYPE=checkbox NAME="subckb" VALUE="ACCIDENTS - AIRPLANE">
> <input TYPE=checkbox NAME="subckb" VALUE="ACCIDENTS -
> AUTOMOBILE">WIDTH=20>&nbsp;</TD><TD><input TYPE=checkbox NAME="subckb"
> VALUE="ACCIDENTS - BOATING">
>
> In mSQL lite $subckb was passed as an array populated by the "value="
>
> Is there a way to do this in PHP. It does not seem to be working quite
> the same as mSQL Lite. Do I have to use the array() function??

Simply change your form to have: NAME="subckb[]"

The trailing [] on the name tells PHP to put all values into an array.

-Rasmus

--
PHP 3 Mailing List   http://www.php.net/
To unsubscribe send an empty message to php3-unsubscribe <email protected>
To subscribe to the digest list:  php3-digest-subscribe <email protected>
For help: php3-help <email protected>  Archive: http://www.tryc.on.ca/php3.html