Just append a pair of brackets to the NAME in the FORM: suspendingAgent[].
This will create an array for the boxes that get checked.

To get the array to a comma separated list on the processing page, try:

$string = implode (",", $suspendingAgent);

Kirk

> -----Original Message-----
> From: Andrew V. Romero [mailto:[EMAIL PROTECTED]]
> Sent: Friday, May 18, 2001 1:15 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Not losing variables in forms w/ checkboxes
> 
> 
> I am working on creating some html forms (that are parsed by PHP) and
> need to use checkboxes, and was wondering how would you go about
> creating the checkboxes so that once the user hits the submit button,
> all of the checkbox variables are included?  Right now I have:
> echo "<input TYPE =\"checkbox\"NAME=\"suspendingAgent\"
> VALUE=\"$availSuspendingAgentNames[$i]\" >
> $availSuspendingAgentNames[$i]";
> In my understanding with how it is now, if the user chooses more than
> one suspending agent, only one suspending agent will be sent 
> to the php
> file once the submit button is hit.  The problem is that the 
> program is
> pulling the names of an unknown number of suspendingAgents from a file
> so I can not just pick say two different names for the check 
> boxes.  The
> only solution that I have thought of is to create a NAME 
> array then each
> checkbox would have its own name such as suspendingAgent[0], but this
> seems rather cumbersome seeing as I would then have to write more code
> to figure out which check box names were checked.  So I was 
> wondering if
> there was an easier way to go about this?  It would be excellent if
> there was someway to have the script combine all the values of the
> checked check boxes into one value seperated by commas and 
> have it still
> with the name of suspendingAgent.
>     Thanks for any ideas,
>     Andrew V. Romero
>     To reply personally, remove all numbers from my address.
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: 
> [EMAIL PROTECTED]
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to