Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Arno Welzel Newsgroups: comp.lang.php Subject: Re: How to get the POST name of a field in a form that uses a counter Date: Thu, 15 May 2014 10:22:47 +0200 Lines: 44 Message-ID: <53747957.404@arnowelzel.de> References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit X-Trace: individual.net YYPtWeWB6/ibVaSgcnMdRQqw5261WOML2UxwLwKAzzyWcnCZai Cancel-Lock: sha1:DVFCOeOqrYKKdjlHLh/vwg+vDKU= User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 In-Reply-To: Xref: csiph.com comp.lang.php:13709 Am 15.05.2014 01:22, schrieb Adrienne Boswell: > I need to how to get the POST name of a field in a form that uses a > counter. The fields are named based on that loop. Below is a small > snippet of what I am doing: > > > $howmuch = array(20, 30, 5, 10, 15); > > ?> >
> for($s=0;$s {?> > > > > > > Here's where my problem is: > > When the user hits submit, I would get something in the post array like: > > howmuch0 : 20 > howmuch1 : 30 > howmuch2 : 5 > howmuch3 : 10 > howmuch4 : 15 > > On a regular form, value="" works just > fine, but since I'm naming the field in a loop, I need to have that, too. > Using $_POST[$howmuch ?]$s; is not valid. foreach() should be your friend. -- Arno Welzel http://arnowelzel.de http://de-rec-fahrrad.de http://fahrradzukunft.de