Not losing variables in forms w/ checkboxes

From: Date: Fri, 18 May 2001 19:15:10 +0000
Subject: Not losing variables in forms w/ checkboxes
Groups: php.general 
Request: Send a blank email to php-general+get-53471@lists.php.net to get a copy of this message
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.

« previous php.general (#53471) next »