Page 1 of 1

Passing PHP Arrays between HTML pages

Posted: Thu Aug 01, 2002 11:07 am
by strongestbear
HI all
I am querying my database and returning an array of values.
Is there anyway I can make this array available in my next HTML page?
Right now I have a loop that converts all elements in the returned row into HIDDEN HTML variables. These HIDDENS can very easily be passed between pages. Although, when it comes time for me to check the users input with the Database Information(to see if there were any changes) the process becomes very slow. A guy(myself) would think that some PHP gurus would know how to pass my arrays. The ability to pass arrays would reduce the amount of querries made and the time in which it takes me to check/save modifications.
A big TIA for any advice
The Bear....The Strongest that is!

Additional Info

Posted: Thu Aug 01, 2002 12:31 pm
by strongestbear
I tried to pass the whole array as an HTML "HIDDEN". That doesn't work either.
Da Bear

Posted: Thu Aug 01, 2002 2:28 pm
by MattF
How about using sessions?

Posted: Fri Aug 02, 2002 6:09 am
by mikeq
Have a look at implode() and exlpode() functions

take your array impode() it, put that value into 1 hidden field, when you get to your next page take the hidden field value and explode() it into an array 8)

Posted: Fri Aug 02, 2002 9:01 am
by strongestbear
Mikeq
I think this will work. Tanks for da help.
Oh yeah! Dair are two PHP functions of equal utility.
Which one is betta? The one named Ditka.
Da Bear

AHH Mann!

Posted: Fri Aug 02, 2002 9:25 am
by strongestbear
It works for the most part.
Except....(there is always an except) I can't get the array indexes to write using the implode/explode/hide method. The implode() only uses number indexes and doesn't actually retrieve the keys from the array being imploded. Now that is a bummer and a half (aka bummer bum).
Thanks for all the Help
Da Bear

Posted: Fri Aug 02, 2002 9:48 am
by twigletmac

Posted: Fri Aug 02, 2002 10:20 am
by jason
Serializing the array might also be good.... :D :D

Posted: Fri Aug 02, 2002 11:41 am
by EricS
sessions