Actually if you really want to pass it through the URL you can do it this

<a href="sample2.php?<? for ($I=0, $I<count($array); $I++) echo
"array[]={$array[$I]}&"; ?>">

There are other ways of doing it, but basically you want a URL that looks
like this:

<a href="sample2.php?array[]=var1&array[]=var2&array[]=var3">

This tells php that that variable through the url is to be parsed as an

You can also, like Edward said, use hidden fields in a form, use sessions.
You can also use cookies with serialize to pass them, which since most
people accept them it is usually ok.  There are ways of checking for cookies
also.  Hmm.. What else probably lots of other ways, but if you donšt mind
the url mess then you might as well do the above example.  I've used all of
the above examples it just depends on what you are using it for in my
opinion :)  I hope it helps!



"And God shall wipe away all tears from their eyes; and there shall be no
more death, neither sorrow, nor crying, neither shall there be any more
pain: for the former things are passed away." - Revelation 21:4

> From: "Edward van Bilderbeek - Bean IT" <[EMAIL PROTECTED]>
> Date: Thu, 11 Apr 2002 10:37:44 +0200
> To: "Hirono Tanaka" <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]>
> Subject: Re: [PHP] passing array to another php file
> two possibilities:
> - put your array in a form with hidden fields
> - use sessions
> I would prefer the second option (check manual for sessions)
> Greets,
> Edward
> ----- Original Message -----
> From: "Hirono Tanaka" <[EMAIL PROTECTED]>
> Sent: Thursday, April 11, 2002 10:33 AM
> Subject: [PHP] passing array to another php file
>> Hi, does anyone know how to pass an array to different php file?
>> Let's assume I have an array $array[] in sample1.php.  I want to pass the
>> array to a different php files by doing something like:
>>   <a href=\"sample2.php?array=".$array[]."\">...</a>
>> This didn't work actually.  I can't think of any other wayto do this.
>> Please help.  Thanks.
>> _________________________________________________________________
>> Chat with friends online, try MSN Messenger:
>> -- 
>> PHP General Mailing List (
>> To unsubscribe, visit:
> -- 
> PHP General Mailing List (
> To unsubscribe, visit:

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to