Re: [newbie] Array form values.

From: Date: Tue, 06 Feb 2001 16:45:43 +0000
Subject: Re: [newbie] Array form values.
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-38398@lists.php.net to get a copy of this message
Well, I'd need the key - I don't want to have a system that breaks if someone deletes a record while someone else is mulling over the form, before they submit it. So I'm going to need the id number for each record changed. Also, my real form is going to have more than one field doing this - email, rank, and name, that I know of so far. ----- Original Message ----- From: "Toby Butzon" <php-lists@imawebdesigner.com> To: <huntsman@www.nisu.flinders.edu.au> Cc: "April" <april@farstrider.org>; "PHP General" <php-general@lists.php.net> Sent: Tuesday, February 06, 2001 10:36 AM Subject: Re: [PHP] [newbie] Array form values. > 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 | ò4~Ç"´ 73l æ > > ¸ehttp://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 > > -- > 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 >

« previous php.general (#38398) next »