Re: Passing Arrays between pages
| From: | afan@afan.net | Date: | Tue, 22 Mar 2005 22:06:26 +0000 |
| Subject: | Re: Passing Arrays between pages | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-211332@lists.php.net to get a copy of this message | ||
1. you can put your array in string using implode() function and on next page create the array back using explode() function.
$testArray = implode('|', $testArray);
# you will get: "Apple|Banana|Peach"
On next page: $testArray = explode('|', $testArray);
2. use serialize()/unserialize() functions
For more info read manual.
-afan
PartyPosters wrote:
Hello, Please can someone tell me how you pass arrays between PHP pages. I have tried something like this and have tried many variations of this but nothing working yet ; Page 1 $testArray[0] =Apple; $testArray[1] =Banana; $testArray[2] =Peach; echo "<INPUT NAME = \"kcompany[]\" TYPE = \"hidden\" VALUE=\"$testArray\">"; Page2 echo $testArray[1]; On different variations of this I keep on getting 'Array' when I to return the variable on the second page Many Thanks. Kaan.