unserialize() isn't working....

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sebastian Aguilera

    #1

    unserialize() isn't working....

    Hi everyone.
    I have some troubles using the unserialize() function.

    I have serialized an array and that works perfect:

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

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

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

    And, as I echoed out, WHY?

    why isn't it working??

    Please help!
    /Sebastian

  • Pedro Graca

    #2
    Re: unserialize() isn't working....

    Sebastian Aguilera wrote:[color=blue]
    > Hi everyone.
    > I have some troubles using the unserialize() function.
    >
    > I have serialized an array and that works perfect:
    >
    > echo '<input type="hidden" name="vardekedj a" value="'.serial ize($_POST
    > ['vardekedja']).'">';
    >
    > Gives the output:
    > a:3:{i:0;s:7:
    >
    > Then on a later page I write:
    > $vardekedja = $_POST['vardekedja'];
    > $varde = unserialize($va rdekedja);
    > echo $vardekedja; echo '
    > ';
    > echo $varde; echo '
    > ';
    > echo 'why?';
    >
    > And, as I echoed out, WHY?
    >
    > why isn't it working??[/color]

    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="vardekedj a" value="'
    . htmlentities(se rialize($_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 =--

    Comment

    Working...