Problem passing arrays between pages using serialize method
Posted: Tue Dec 13, 2005 11:52 am
Hello,
I'm trying to serialize an array, then throw it into a url stream to pass it to a new page where I will then unserialize the array. When I pass it to the next page and do a print_r( $unserialized_array ), I get no values.
Here's the code I'm trying:
Page 1:
Page 2:
I'm trying to serialize an array, then throw it into a url stream to pass it to a new page where I will then unserialize the array. When I pass it to the next page and do a print_r( $unserialized_array ), I get no values.
Here's the code I'm trying:
Page 1:
Code: Select all
$array = array();
$array["a"] = "Foo";
$array["b"] = "Bar";
$array["c"] = "Baz";
$array["d"] = "Wom";
$test_array = serialize( $array );
Url string: <a href="page_2.php?serialized_array=<?=$test_array ?>" >Code: Select all
$this_code_array = array();
$this_code_array = unserialize( urldecode( $_REQUEST['serialized_array'] ) );
print_r( $this_code_array ); // will not print anything[php][/php]