I'm a pretty new PHP programmer. Used to more object oriented java/C++, learned PHP on my own (as opposed in a class), and i'm working on this project. Here's what I want to do. Create an array in 1 page. And in page 2 be able to recall that same array. This array might be big, filled with Strings and other Arrays. So i thought maybe using serialize() might work. Here's my test code:
Code: Select all
<?php
$refine = $_GET["refine"];
if ($refine == NULL) {
$refine = array("one","two","three","four");
$ser_refine = serialize($refine));
echo "<a href=\"test.php?refine=".$ser_refine."\">Click Me</a>";
}
else {
$ser_refine = unserialize($refine));
var_dump($ser_refine);
}
?>
Well, it isn't working. the unserialize must be failing because $ser_refine is a FALSE boolean.
Am i doing this completely wrong? I've seen elsewhere that you can just split each item by a comma into a long string then recreating the array. This seems like a very low-tech way to do it. Anyways, any help will.... help. Thanks all in advance.