Re: Re: From form to an array
| From: | Curt Zirzow | Date: | Tue, 18 Nov 2003 14:58:09 +0000 |
| Subject: | Re: Re: From form to an array | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-170101@lists.php.net to get a copy of this message | ||
* Thus wrote Jeff McKeon (jmckeon@telaurus.com):
>
> Form two has 2 fields for every line and the fields need to be kept in
> separate arrays.
>
> /* form2.php */
> <form action="<?PHP Echo $_SERVER['PHP_SELF'] ?>"
> method="POST">
> <input type="hidden" name="tiers" value="<?PHP ECHO
> $_POST['form1info'] ?>">
> <input type="text" name="tier[]">
> <input type="text" name="price[]"><br>
>
> <input type="text" name="tier[]">
> <input type="text" name="price[]"><br>
At this point I'm not sure what your question is now, but while I'm
here I would suggest to define your fields like this to make it
easier to handle:
<input type="text" name="levels[1][tier]">
<input type="text" name="levels[1][price]"><br>
<input type="text" name="levels[2][tier]">
<input type="text" name="levels[2][price]"><br>
Then in php:
$levels = $_POST['levels'];
foreach ($levels as $i => $level) {
echo $level['tier'];
echo $level['price'];
...
}
Curt
--
"My PHP key is worn out"
PHP List stats since 1997:
http://zirzow.dyndns.org/html/mlists/