Passing Arrays Through Forms
| From: | @ Nilaab | Date: | Thu, 16 Jan 2003 18:58:05 +0000 |
| Subject: | Passing Arrays Through Forms | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-131917@lists.php.net to get a copy of this message | ||
Hello Everyone,
I've attempted this many times, but have failed to understand it each time.
I want to make it easier for myself to deal with passing variables through a
form. So I thought, why not use a single array variable to do that. If I do
such a thing, what steps do I need to take to ensure that the values in the
array are intact just as the user entered it? How do I serialize array data
from an initial form? Here's a simple example of what I might have:
<form method="post" action="some_page.php">
<input type="text"
name="form_vars['firstname']"></input>
<input type="text"
name="form_vars['lastname']"></input>
<input type="text" name="form_vars['address']"></input>
<input type="text" name="form_vars['city']"></input>
<input type="text" name="form_vars['state']"></input>
<input type="text" name="form_vars['zip']"></input>
</form>
Now, how do I ensure that the values in the associated array, that will be
sent over to some_page.php, are the values entered by the user? How do I
serialize this array from this form? Or if I cannot do that, what other
steps do I need to take to ensure the preservation of the values passed to
another page as an array?