Re: Pass an array using GET or POST?

From: Date: Fri, 23 Jun 2000 18:53:09 +0000
Subject: Re: Pass an array using GET or POST?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-2845@lists.php.net to get a copy of this message
$array = array ("test", "foo", "bar"); // pass in a url while (list ($k,$v) = each ($array)) { $uarray = urlencode("$k=$v"); } $url_vars = implode ("&", $uarray); echo "<a href='mypage.php?$url_vars'>My Page</a>"; // pass in a form while (list ($k, $v) = each ($array)) { echo "<input type=hidden name='$k' value=\"$v\">"; } hth, Ryan On Thu, Jun 22, 2000 at 05:36:30PM -0600, Scott S. Nicholson wrote: > Is there any way to pass an array from one page to another using GET or > POST? > > ie: > > <? $array = array("test", "foo", "bar"); ?> > <form action="blah.php3" method="POST"> > <input type="hidden" name="array" value="<? echo $array; > ?>"> > <input type="submit"> > </form> > > I've tried this, I've tried serialize($array);, etc. etc. > > I'd rather not go to the trouble of setting up a MySQL connection or writing > to a file if I can avoid it. > > TIA, > > Scott Nicholson > scottn@pnx1.com > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net ---end quoted text---

« previous php.general (#2845) next »