send an array through post and get method
Moderator: General Moderators
send an array through post and get method
Hello,
Is it possible to send an array through post or get?
page1:
$arr=array('hello','goodbye');
echo "<a href=page2.php?a=$arr>tp page 2</a>";
page2:
if(isset($a))
print_r($a);
and the same for post...
Thanks..
Is it possible to send an array through post or get?
page1:
$arr=array('hello','goodbye');
echo "<a href=page2.php?a=$arr>tp page 2</a>";
page2:
if(isset($a))
print_r($a);
and the same for post...
Thanks..
Nope, I tested it, I get Array echoed out. If you want, you might want to do like:
Page 1:
Page 2:
-Nay
Page 1:
Code: Select all
<?
$arr=array('hello','goodbye');
$arr=implode(",",$arr);
echo "<a href=pg2.php?a=$arr>tp page 2</a>";
?>Code: Select all
<?
if(isset($a)) {
$a = explode(",", $a);
echo $a[0];
}
?>I thought about that but i have a problem.
I create a table full of links each needs to send different values i.e. my array.
the easiest is using <a href> with get method. I can't create so many sessions it will slow my server.
I thought about using the post method to send my array as a string and explode it later. is it possible to create so many forms? an I submit them without specify a form name?
I create a table full of links each needs to send different values i.e. my array.
the easiest is using <a href> with get method. I can't create so many sessions it will slow my server.
I thought about using the post method to send my array as a string and explode it later. is it possible to create so many forms? an I submit them without specify a form name?
are you sure loading the session-data when needed is slower than shifting the data forth and back the inet connection over and over again?I can't create so many sessions it will slow my server.
implode() can handle multidimensional arrays.
I can't do that...
I have to much data to send.
I think the post thing will work I jave just 1 problem with that..
because I have many forms and I gave them unique names e.g. f1,f2,f3....
I try to send to the java script function in order to submit a form but when I can't seem to be able to eval my form name in the js func
any ideas?
I have to much data to send.
I think the post thing will work I jave just 1 problem with that..
because I have many forms and I gave them unique names e.g. f1,f2,f3....
I try to send to the java script function in order to submit a form but when I can't seem to be able to eval my form name in the js func
any ideas?