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??
scooter41Asked:
Who is Participating?
 
ozoConnect With a Mentor Commented:
If you do %form = $q->Vars; you can parse the individual elements of kitchen with split/\0/,$form{kitchen}
0
 
ozoCommented:
That will set the variables
$kitchen, $oven, $grill
 Which can be dangerous because someone might get you to set variables like $/ or $^I
0
 
ozoCommented:
You probably want someting like
@appliances = $q->param('kitchen');
0
 
ozoCommented:
#or do you want
$kitchen=join',',$q->param('kitchen');
0
 
TintinCommented:
ozo's solutions are probably what you need.  You could also load everything into a hash, eg:

%form = $q->Vars;

print $form{'kitchen'};

0
All Courses

From novice to tech pro — start learning today.