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($va rname);
$$varname = $passthrough ;
}
Is it something to do with this??
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($va
$$varname = $passthrough ;
}
Is it something to do with this??
You probably want someting like
@appliances = $q->param('kitchen');
@appliances = $q->param('kitchen');
#or do you want
$kitchen=join',',$q->param ('kitchen' );
$kitchen=join',',$q->param
ozo's solutions are probably what you need. You could also load everything into a hash, eg:
%form = $q->Vars;
print $form{'kitchen'};
%form = $q->Vars;
print $form{'kitchen'};
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
$kitchen, $oven, $grill
Which can be dangerous because someone might get you to set variables like $/ or $^I