serialize and unserialize

Associate
Joined
3 Oct 2006
Posts
2,304
Location
London
Hello There,

I'm trying to pass the contents of a comment form through the URL as easily as possible. I was reading about serialize and unserialize. It kind of works but kind of doesnt. It seems to pass all my data through the url fine, but when it comes out of the otherside, I don't get my data back, I just get 'bool(false)' when I do a var dump!

Hope you can help

JB
Code:
// Page 1
// $safe is an array
$serial = serialize($safe);
header ("Location: debate.php?id=".$safe["id"]."&side=".$safe["side"]."&mode=cfailed&serial=".$serial."#commentform");

Code:
// Page 2
$data = $_REQUEST['serial'];
$data = unserialize($data);
var_dump($data);
 
/edit ignore this, I didn't notice you said the string makes it through fine.

How many characters is your serialized object? Could be over the maximum url length and being truncated?

Have you tried printing the serialized string on both pages to check it is identical?
 
I've already used a post to get to PAGE1. PAGE1 isn't seen by the user and I want it to auto-redirect back to PAGE2 (where the comment form is) and put the data, that they have already entered, back into the form...Didn't think to use a session...though! :rolleyes: :D
 
Back
Top Bottom