Posted by cldmismgr on 12/07/06 10:19
Krustov wrote:
> <comp.lang.php>
> <kirke>
> <6 Nov 2006 03:24:08 -0800>
> <1162812248.829522.49860@b28g2000cwb.googlegroups.com>
>
> > I have two arrays in previous page and use the arrays in next page.
> > (Action page)
> > how can I do this?
> >
>
> - write them to a flat file
>
> - read the flat file on the next page
>
>
> --
> www.phpchatroom.co.uk
This can be done with serialize and urlencode as follows.
<?php
if (isset($_REQUEST) {
$decode_hidden = urldecode($_REQUEST['hidden_array_value'];
$new_array = unserialize($decode_hidden);
}
$array[] = 'one';
$array[] = 'two';
$pass_array = serialize($array);
$encode_array = urlencode($pass);
print "<form>";
print "<input type='hidden' name='hidden_array_value'
value='$encode_array' ";
print "</form>";
?>
The serialized array must be urlencoded to handle the characters
injected by the serialize command.
Craig
[Back to original message]
|