From: Peter Brawley Date: March 22 2005 11:48pm Subject: Re: Passing Arrays between pages List-Archive: http://lists.mysql.com/mysql/181596 Message-Id: <4240AEC1.3020206@earthlink.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=======AVGMAIL-4240AEC17B30=======" --=======AVGMAIL-4240AEC17B30======= Content-Type: multipart/alternative; boundary=------------040106090301030807090505 --------------040106090301030807090505 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Or you can issue session_start() at the top of each page, assign your array to $_SESSION[] in one page, and pluck it from the session array in the other page. (But you asked the question in the wrong forum) PB ----- Mike Johnson wrote: >From: PartyPosters [mailto:sales@stripped] > > > >>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 ">VALUE=\"$testArray\">"; >> >>Page2 >>echo $testArray[1]; >> >> > >This is more of a PHP question, and I'm sure you'll be admonished for >it, but I'll answer it anyway. Essentially, you need to construct the >array elements as their own hidden values. > >echo "VALUE=\"Apple\">"; >echo "VALUE=\"Banana\">"; >echo "VALUE=\"Peach\">"; > >At that point, if you call: > >echo $kcompany[1]; > >after the form submit, you'll get Banana. > >HTH! > > > --------------040106090301030807090505 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Or you can issue session_start() at the top of each page, assign your array to $_SESSION[] in one page, and pluck it from the session array in the other page.

(But you asked the question in the wrong forum)

PB

-----

Mike Johnson wrote:
From: PartyPosters [mailto:sales@stripped] 

  
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];
    

This is more of a PHP question, and I'm sure you'll be admonished for
it, but I'll answer it anyway. Essentially, you need to construct the
array elements as their own hidden values.

echo "<INPUT NAME = \"kcompany[]\" TYPE = \"hidden\"
VALUE=\"Apple\">";
echo "<INPUT NAME = \"kcompany[]\" TYPE = \"hidden\"
VALUE=\"Banana\">";
echo "<INPUT NAME = \"kcompany[]\" TYPE = \"hidden\"
VALUE=\"Peach\">";

At that point, if you call:

echo $kcompany[1];

after the form submit, you'll get Banana.

HTH!

  
--------------040106090301030807090505-- --=======AVGMAIL-4240AEC17B30======= Content-Type: text/plain; x-avg=cert; charset=us-ascii Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Content-Description: "AVG certification" No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.8.0 - Release Date: 3/21/2005 --=======AVGMAIL-4240AEC17B30=======--