William Stokes a écrit :
Can someone help me to get started with serializing? I think I did'nt quite understand the manual here...

serialize and unserialize don't modify your variable, but the return value is a string or a "mixed" (which means it can be a very complicated structure, or a simple
array, an object, etc).

first_script.php :
$string_from_array = serialize($array);
<form action="second_script.php" method="post">
<input type="hidden" name="art_siirt_jouk" value="$string_from_array">
<button type="button" value="submit">
</form>

second_script.php :
print_r($POST);
$string = $_POST["art_siirt_jouk"];
$array = unserialize($string);

hope this'll help.

N F


How to post to $PHP_SELF and read this simple array?

<?
//print the posted array here
print_r($arr_siirt_jouk);

//create the array and post it in another name
$arr_siirto = array(1,2,3);
<input type="hidden" name="arr_siirt_jouk" value="<?php echo "$arr_siirto";?>">
?>


I tried:

<?
//print the posted array here
unserialize($arr_siirt_jouk);
print_r($arr_siirt_jouk);

//create the array and post it in another name
$arr_siirto = array((serialize('1','2','3'));
<input type="hidden" name="arr_siirt_jouk" value="<?php echo "$arr_siirto";?>">
?>

Which, to my great surprice, didn't work :)


Thanks
-Will


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to