Okay, I am trying to use serialization to pass my multidimensional array
from one page to the other.  I wrote a simple test page that passes the
serialized data to the page and then attempts to print it out.  But for
some reason I keep getting an error that reads : "Notice: unserialize()
failed at offset 20 of 2217 bytes in D:\public\internal\serializeTest.php
on line 22" (line 22 is the unserialize call).

This script seems as harmless as can be...what could be causing the error?

***

<?

if(isset($_POST['serialArray']))
{

$keyArray = array_keys($_POST);

for ($i=0;$i<count($keyArray);$i++)
{

        if($keyArray[$i]=="serialArray")
        {
                echo unserialize($_POST['serialArray']);
        }

}






}else
{

echo "<form action='thisPage.php' method='post'>";

for($i=0;$i<10;$i++)
{
        for($j=0;$j<10;$j++)
        {
                $aTest[$i][$j] = "Test $i $j";
        }

}

$sTest = serialize($aTest);
echo "<input type='hidden' name='serialArray' value='$sTest'>";

echo '<input type="submit" name="Submit" value="Submit">';
echo $sTest;

echo "</form>";

}

?>

***







Reply via email to