Re: Multiple variables
| From: | Miguel Cruz | Date: | Tue, 28 May 2002 19:25:50 +0000 |
| Subject: | Re: Multiple variables | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-99545@lists.php.net to get a copy of this message | ||
On Tue, 28 May 2002, Morten Nielsen wrote:
> I got a table, which contains a lot of text-boxes. Each textbox has a name:
>
> Text1
> Text2
> Text3
> etc.
>
> Is it possible to check if they are all set using a for-loop?
> I think of something like:
>
> for($i=1;$i<10;$i++)
> {
> if(empty("Text"+$i))
> {
> do something...
> }
> }
The easiest approach would be to name your boxes like this:
<input name="text[1]">
<input name="text[2]">
and so on.
Then you can just loop through the $_REQUEST['text'] array when you're
processing the form.
miguel