Re: Passing Arrays Through Forms
| From: | Sancar Saran | Date: | Fri, 17 Jan 2003 08:17:38 +0000 |
| Subject: | Re: Passing Arrays Through Forms | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-131978@lists.php.net to get a copy of this message | ||
On Thursday 16 January 2003 20:58, superbus22@attbi.com wrote:
> 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>
>
<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>
some_page.php
<?
$form_vars = $_POST["form_vars"];
?>