Passing PHP Arrays between HTML pages

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
strongestbear
Forum Newbie
Posts: 4
Joined: Thu Aug 01, 2002 11:07 am

Passing PHP Arrays between HTML pages

Post 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!
strongestbear
Forum Newbie
Posts: 4
Joined: Thu Aug 01, 2002 11:07 am

Additional Info

Post by strongestbear »

I tried to pass the whole array as an HTML "HIDDEN". That doesn't work either.
Da Bear
MattF
Forum Contributor
Posts: 225
Joined: Sun May 19, 2002 9:58 am
Location: Sussex, UK

Post by MattF »

How about using sessions?
User avatar
mikeq
Forum Regular
Posts: 512
Joined: Fri May 03, 2002 3:33 am
Location: Edinburgh, Scotland

Post 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)
strongestbear
Forum Newbie
Posts: 4
Joined: Thu Aug 01, 2002 11:07 am

Post 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
strongestbear
Forum Newbie
Posts: 4
Joined: Thu Aug 01, 2002 11:07 am

AHH Mann!

Post 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
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

jason
Site Admin
Posts: 1767
Joined: Thu Apr 18, 2002 3:14 pm
Location: Montreal, CA
Contact:

Post by jason »

Serializing the array might also be good.... :D :D
EricS
Forum Contributor
Posts: 183
Joined: Thu Jul 11, 2002 12:02 am
Location: Atlanta, Ga

Post by EricS »

sessions
Post Reply