> --- Andrei Verovski <[EMAIL PROTECTED]> wrote:
> > I am need to pass serialized assotiative array via form hidden
> > field (not GET or POST).
>
> This is impossible. A hidden form field is simply a form field that is not
> displayed to the user. Form actions must be GET or POST.
>
> > In order to do it, I did the following: urlencode(serialize($my_array)).
>
> Don't URL encode the value of the form field, since the browser will take
care
> of that. You should probably use POST rather than GET, because serializing
an
> array might yield a very long string and make the URL too large for the
Web
> browser and/or Web server to handle.

I didn't see the original thread, but judging from the title, this is how
you'd do it:

<input type="hidden" name="serialized_array"
value="<?=htmlentities(serialize($array))?>">

And to retrieve:

$array = unserialize(stripslashes($_POST['serialized_array']));
(assuming magic_quotes_gpc is ON)

---John Holmes...


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

Reply via email to