Page 1 of 1

PHP/CGI form processing with same-named checkboxes

Posted: Wed Oct 15, 2008 9:18 am
by rob3139
Dear All,

Bit of a headscratcher this one - I hope you guys can help.

I'm trying to process a form automatically using PHP and CURL. It all goes fine until there are multiple checkboxes with the same name, eg.

<input type="checkbox" name"cb1" value="1" />
<input type="checkbox" name"cb1" value="2" />

Now the form is actually processed using a CGI script that I don't have access too. I'm passing the form variables to the cgi script using PHP & CURL. But because PHP can't cope with same-named checkboxes without an array attached (ie. cb1[]), and attaching the array confuses the CGI script, I'm stuck.

Anyone got any idea how I can get the scripts to talk to each other?

Thanks in advance,

Rob

Re: PHP/CGI form processing with same-named checkboxes

Posted: Wed Oct 15, 2008 9:21 am
by aceconcepts
Why do they have to have the same names?

Re: PHP/CGI form processing with same-named checkboxes

Posted: Wed Oct 15, 2008 9:27 am
by papa
Multible <select> maybe?

Re: PHP/CGI form processing with same-named checkboxes

Posted: Wed Oct 15, 2008 9:31 am
by rob3139
Thanks for your quick replies. The problem is I cannot change the form (or the CGI script) - they are part of the system I am trying to automate using CURL. So I'm stuck with the form.

Any ideas??

Thanks again,

Rob

Re: PHP/CGI form processing with same-named checkboxes

Posted: Wed Oct 15, 2008 9:34 am
by papa
What do you want the checkboxes to pass?

If the script gets confused by an array, in what format would you pass the same named variable with different values without overwriting?

Re: PHP/CGI form processing with same-named checkboxes

Posted: Wed Oct 15, 2008 9:53 am
by rob3139
That's exactly my question - is there any way I can get the variables to the CGI script via PHP in a way the CGI script would understand them?

Re: PHP/CGI form processing with same-named checkboxes

Posted: Wed Oct 15, 2008 9:56 am
by papa
It sounds pretty hard if you can't edit the form or the cgi script m8. :P

With a multiple select for example, you could convert the data to a string with php and then pass it on.