By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,872 Members | 2,392 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,872 IT Pros & Developers. It's quick & easy.

unserialize() isn't working....

P: n/a
Hi everyone.
I have some troubles using the unserialize() function.

I have serialized an array and that works perfect:

echo '<input type="hidden" name="vardekedja" value="'.serialize($_POST
['vardekedja']).'">';

Gives the output:
a:3:{i:0;s:7:

Then on a later page I write:
$vardekedja = $_POST['vardekedja'];
$varde = unserialize($vardekedja);
echo $vardekedja; echo '
';
echo $varde; echo '
';
echo 'why?';

And, as I echoed out, WHY?

why isn't it working??

Please help!
/Sebastian

Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Sebastian Aguilera wrote:
Hi everyone.
I have some troubles using the unserialize() function.

I have serialized an array and that works perfect:

echo '<input type="hidden" name="vardekedja" value="'.serialize($_POST
['vardekedja']).'">';

Gives the output:
a:3:{i:0;s:7:

Then on a later page I write:
$vardekedja = $_POST['vardekedja'];
$varde = unserialize($vardekedja);
echo $vardekedja; echo '
';
echo $varde; echo '
';
echo 'why?';

And, as I echoed out, WHY?

why isn't it working??


Have you tried "View Source"?

serialize() uses double quotes (") and these quotes don't mix well with
the HTML quotes!
try htmlentities()

echo '<input type="hidden" name="vardekedja" value="'
. htmlentities(serialize($_POST['vardekedja']))
. '">';

But why are you serializing the $_POST array to put _into_ the form?
Well ... try it :-)
--
--= my mail address only accepts =--
--= Content-Type: text/plain =--
--= Size below 10K =--
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.