RE: [PHP] Forms and Arrays

From: Date: Fri, 28 Nov 2003 17:31:23 +0000
Subject: RE: [PHP] Forms and Arrays
Groups: php.general 
Request: Send a blank email to php-general+get-171292@lists.php.net to get a copy of this message
On 28 November 2003 17:22, Dave Carrera wrote: > Thank you for clearing up my rather lame explanation. > > So how can I process $_POST[dynamic-name][user-entered-value] > arrays to give > me my desired output: > > fname0 = value flab0 = value fplc0 = value > fname1 = value flab1 = value fplc1 = value > fname2 = value flab2 = value fplc2 = value > > Any help our example will be most appreciated. Well, like I say, you've pretty much written it there. You need a loop which outputs one line on each iteration -- the body of the loop will look something like: echo "fname$i = {$_POST['fname'][$i]}" . " flab$i = {$_POST['flab'][$i]}" . " fplc$i = {$_POST['fplc'][$i]}" There's any number of ways you could write the loop so that $i has the approriate value on each iteration, but a for() loop would probably be the conventional one. Cheers! Mike --------------------------------------------------------------------- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: m.ford@leedsmet.ac.uk Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211

« previous php.general (#171292) next »