Link to home
Start Free TrialLog in
Avatar of scooter41
scooter41

asked on

Checkboxes, variables, comma separeted...

Hi there,

I am trying to parse a huge form with about a billion checkboxes! well quite a few, with different sections having the same checkbox name (in the below example called kitchen), so as I can receive the data in the following format....

kitchen=sink,oven,grill

where the checkboxes sink,oven and grill have been checked respectivly.

However, all I receive is up to the first value, in this case sink, without the others on the end.

I am parsing the data using the following format....

@names = $q->param;
foreach $varname (@names)
{
$passthrough=$q->param($varname);
 $$varname = $passthrough ;
}


Is it something to do with this??
Avatar of ozo
ozo
Flag of United States of America image

That will set the variables
$kitchen, $oven, $grill
 Which can be dangerous because someone might get you to set variables like $/ or $^I
You probably want someting like
@appliances = $q->param('kitchen');
#or do you want
$kitchen=join',',$q->param('kitchen');
Avatar of Tintin
Tintin

ozo's solutions are probably what you need.  You could also load everything into a hash, eg:

%form = $q->Vars;

print $form{'kitchen'};

ASKER CERTIFIED SOLUTION
Avatar of ozo
ozo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial