This method seems to have a size limitation (which is very small).
 If your array is (relatively) large, page two will not display the
 passed values.

 I'm not sure the url string became too long or if the problem came from
SERIALIZE(). Just beware.

FYI

-john

=P e p i e  D e s i g n s
 www.pepiedesigns.com
 Providing Solutions That Increase Productivity

 Web Developement. Database. Hosting. Multimedia.

On Wed, 15 Jan 2003, Danielle van Gladbach wrote:

> It works thanks!!!!
>
> Here is the code, if anyone has the same problem:
> test1.php
> <?
> $org["index-A"]=17010000;
> $org["index-B"]=12090000;
>
> $var=serialize($org);
> $var=urlencode($var);
>
> print "<a href=\"test2.php?var=".$var."\">test2</a><BR>\n";
> ?>
>
> test2.php
> <?
> $var=urldecode($var);
> $org=unserialize($var);
>
> while (list ($key, $val) = each($org))
>  {
>  print "key=".$key."val".$val."<br>\n";
>  }
> ?>
>
> Jason Wong wrote:
>
> > On Wednesday 15 January 2003 20:59, Danielle van Gladbach wrote:
> >
> > > I am trying to send an array from one php to another:
> > >
> > > $org["index-A"]=17010000;
> > > $org["index-B"]=12090000;
> > >
> > > print "<a href=\"test2.php?org=".$org."\">test2</a><BR>\n";
> > >
> > > But if I try to read te array in test2.php, I get "Warning: Variable
> > > passed to each() is not an array ".
> >
> > You can't pass an array thru the URL. What you need to do is serialize() it
> > then urlencode() it (or maybe rawurlencode()). Then you can put the resulting
> > string in the URL.
> >
> > In test2.php you would unserialize() $org ($_GET['org']).
> >
> > --
> > Jason Wong -> Gremlins Associates -> www.gremlins.biz
> > Open Source Software Systems Integrators
> > * Web Design & Hosting * Internet & Intranet Applications Development *
> >
> > /*
> > E Pluribus Unix
> > */
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to