Passing arrays ... I'm going nuts here ...

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
Tubbietoeter
Forum Contributor
Posts: 149
Joined: Fri Mar 14, 2003 2:41 am
Location: Germany

Passing arrays ... I'm going nuts here ...

Post by Tubbietoeter »

Hi guys ...


I got a script that does some things and has the results in an array. when a user clicks a button, a new frameset has to be loaded; top is navigation and bottom content.

now, i need to pass the values of the array to the navigation.

first i pass the array via POST to the frameset.

there i call the navigation script with:
echo '<frame src="site.php?result="'.$_POST['result'].'" ...

unfortunately the value of $_GET['result'] in site.php (navigation) is "array" ... just the string, no real array ...


what can i do?

cookies and session variables are not an option here ...
pootergeist
Forum Contributor
Posts: 273
Joined: Thu Feb 27, 2003 7:22 am
Location: UK

Post by pootergeist »

an array is not a string therefore cannot be passed (in an unmanipulated) format through a query string.

the main way of getting round that is using serialize and unserialize to convert the array to a string and then back to an array

echo '<frame src="site.php?result=' .serialize($_POST['result']). '">';

then in site.php

result_array = unserialize($_GET['result']);
NoReason
Forum Commoner
Posts: 51
Joined: Tue Sep 10, 2002 6:19 pm

parsing a serialzed string

Post by NoReason »

are there functions to parse the serialzed string? or would I have to code one my self.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

Post Reply