Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Forms

Status
Not open for further replies.

mike101

Programmer
Jul 20, 2001
169
US
Hey,
I have about 5 checkboxes on the page in a form. When it submits I want it to combine the checks. What I mean by that is say in the 5 checkboxes the values are "test" "hi" "cool" "whats" "up" and the name for all is "input" and "whats" and "up" are selected it will send it to the cgi script as file.cgi?input=whats,up currently it sends it as file.cgi?input=whats&input=up and I need it to somehow combine these to make that. Is there any way to do this? Thanks.
 
If you use the same name for all the checkboxes then use the post method to submit your form it should be submitted in this format.

whats,up

the only thing is that only the selections they choose will show up. So if they submit your form as is it would show up like above.

I hope that helps
 
1) in any case, you can read the variables and then concat the strings.
2) as yandso said, you can make all the checkboxes with the same name, then they all will be stored as one array. ---
---
 
I don't believe that using POST instead of GET will change the way the values are passed in that manner. You should still get multiple occurrences of var=value with POST. How this is handled depends on what you're doing with them in your CGI program. I don't know what CGI.pm does with them, since I don't use it. I wrote my own code years ago to get form variables. If I run across multiple instances I concatenate them with a null character between them, so it's easy to test for and to split on. Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top