Re: [newbie] Array form values.
| From: | Toby Butzon | Date: | Tue, 06 Feb 2001 16:36:53 +0000 |
| Subject: | Re: [newbie] Array form values. | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-38397@lists.php.net to get a copy of this message | ||
Or you might try a foreach($array as $element)... about the same but it
doesn't give you they key - just the value (as $element).
foreach ($email as $current) {
// process this email addr
} // move on to the next one until the whole arr of them has been proc'd
Good luck-
--Toby
David Robley wrote:
>
> On Tue, 6 Feb 2001 08:57, April wrote:
> > I have a form that is an extended version of this:
> >
> > <form>
> > <input type="text" name="email[1]">
> > <input type="text" name="email[2]">
> > <input type="text" name="email[3]">
> > </form>
> >
> > Unfortunately, the email[1] part was generated using a variable in a
> > loop. I have no idea how many of these fields there really will be each
> > time this is done.
> >
> > I then need to turn around and, while processing the form, extract the
> > values for each field in another loop.
> > Trying to do echo $email[$i] doesn't seem to work, though.
> >
> > Is my entire logical approach wrong? Could it be something wrong with
> > syntax? Is it not possible to use a variable as the inner part of an
> > array like that? ooo, or best one to answer: does someone have a
> > snippet of code doing what I want to do here, that I could learn from?
>
> Have a look at the functions list and each - there are code snippets in the
> manual which should give you some ideas for getting the values and keys
> from an array. You might also be interested in count and sizeof for
> determining the number of elements in the array.
>
> --
> David Robley | WEBMASTER & Mail List Admin
> RESEARCH CENTRE FOR INJURY STUDIES |
> http://www.nisu.flinders.edu.au/
> AusEinet |
> http://auseinet.flinders.edu.au/
> Flinders University, ADELAIDE, SOUTH AUSTRALIA
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net