Re: Passing Serialized Array via Hidden field
| From: | John Manko | Date: | Mon, 21 Jul 2003 16:05:30 +0000 |
| Subject: | Re: Passing Serialized Array via Hidden field | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-156087@lists.php.net to get a copy of this message | ||
Just a small point, you can have both GET and POST.
------ search.html -----
<form method=POST action='page.php?action=search&sid=09h34fnn3f0qn34f8n38fn34htq83th83qh' >
<input name=search type=text>
<input type=submit value='Find It!'>
</form>
----- page.php --------
$sid = $_GET['sid'];
session_id($sid);
session_start();
$search = $_POST['search'];
Also, for those who don't know, you can even reference hash links
<a href='page.php?action=something#myhashlink>
Chris Shiflett wrote:
--- Andrei Verovski <andreil1@mail.starlett.lv> 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. Hope that helps. Chris ===== Become a better Web developer with the HTTP Developer's Handbook http://httphandbook.org/