Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 184
  • Last Modified:

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??
0
scooter41
Asked:
scooter41
  • 4
1 Solution
 
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
 
ozoCommented:
If you do %form = $q->Vars; you can parse the individual elements of kitchen with split/\0/,$form{kitchen}
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now