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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to post an array to a form

Status
Not open for further replies.

nazarka

Programmer
Joined
Aug 6, 2003
Messages
5
Location
US
Hi,
I'm trying to submit a form via curl and one of the form fields allows multiple selections - I'd like to select multiple selections - I'd like to submit an array with the selection numbers. I did not write the script behind the form that I'm submitting to and so I can't use serialize, does anyone know another way this can be done?

Thank a bunch.
 
I wrote my own script to test out if serialize would work:

test.php:
if(!isset($a))
{
print "a not set";
exit;
}
foreach ($a as $v)
print "Current value of \$a: $v.\n";

in post.php I have:

$urlstring=urlencode("a=" .serialize($a));

when I use curl in post.php to submit to test.php
I get "a not set"
So if I don't use unserialize it doesn't recognize $a.
And I don't think the sript I'm trying to post to is using unserialize.
 
I got it now.
thanks anyway :)
I had a extra urlencode in my script.

passing a[0]=0&a[1]=1 works.
 
hmm... if asking for $a by itself in coldfusion doesn't work when passing a[0]=1&a[1]=...
 
that did the trick.
thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top