Page 1 of 1

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

Posted: Tue Aug 26, 2003 5:35 am
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 ...

Posted: Tue Aug 26, 2003 9:57 am
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']);

parsing a serialzed string

Posted: Tue Aug 26, 2003 12:14 pm
by NoReason
are there functions to parse the serialzed string? or would I have to code one my self.

Posted: Tue Aug 26, 2003 12:35 pm
by volka