RE: [PHP] Forms and Arrays

From: Mike Ford (M.Ford_at_lmu.ac.uk)
Date: 11/28/03


To: 'Dave Carrera' <dave@ephgroup.com>, "'Ford, Mike               [LSS]'" <M.Ford@lmu.ac.uk>
Date: Fri, 28 Nov 2003 17:31:23 -0000

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



Relevant Pages

  • RE: [PHP] stepping through alphabet
    ... so your loop has to be: ... Mike Ford, Electronic Information Services Adviser, ... Learning Support Services, Learning & Information Services, ...
    (php.general)
  • Re: toroidal conductivity sensor
    ... supply 8khzcan i still get the desired output to mesure ... into the water loop will be of the order of 10mV. ... > horizontal pipe and one on the bottom horizontal pipe. ... > core induce current in the loop, and the other core measure that loop ...
    (sci.electronics.design)
  • Re: toroidal conductivity sensor
    ... supply 8khzcan i still get the desired output to mesure ... into the water loop will be of the order of 10mV. ... > horizontal pipe and one on the bottom horizontal pipe. ... > core induce current in the loop, and the other core measure that loop ...
    (sci.electronics.design)
  • Re: Sort by Hash
    ... I have a loop that extracts data into the following variables from ... I would like to sort the data using the hash key. ... include an example of the desired output ...
    (perl.beginners)