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.

Dave C


-----Original Message-----
From: Ford, Mike [LSS] [mailto:[EMAIL PROTECTED] 
Sent: 28 November 2003 14:50
To: 'Dave Carrera'; [EMAIL PROTECTED]
Subject: RE: [PHP] Forms and Arrays


On 28 November 2003 14:36, Dave Carrera wrote:

> Hi List,
> 
> I have a dynamically generated form with inputs with names that create 
> arrays i.e.:
> 
> <input name="fname[]">
> <input name="flab[]">
> <input name="fplc[]">
> 
> The extra bits for the inputs are omitted deliberately for this 
> question but exists in the form i.e.: size, value, type.
> 
> And these are repeated as many time as required.
> 
> Thus they are generating arrays called:
> 
> Fname0
> Flab0
> Fplc0
> Fname1
> Flab1
> Fplc1
> Fname2
> Flab2
> Fplc2

Sorry to be pedantic, but, no, they are generating arrays called fname,
flab, and fplc.  The elements of these arrays are fname[0], fname[1],
fname[2]..., flab[0], flab[1]... etc.

> And so on as per the num of dynamically generated input lines for the 
> form.
 
> My question is

This describes one way of handling the arrays:

>  how can I treat each array separately and then
> move on to the
> next until end ?
> 
> SO the output would be :

... but this illustrates exactly the opposite way of treating them:
 
> fname0 = value flab0 = value fplc0 = value
> fname1 = value flab1 = value fplc1 = value
> fname2 = value flab2 = value fplc2 = value

So which is it you want?  Presumably, your example output is correct and the
description is wrong, and what you really want to do is address the first
element of each array, then the second element of each array, and so on.  In
which case, you've pretty much described how to do it in your example
output, and your only remaining problem is how to find out how long the
arrays are -- for which I recommend you take a look at
http://www.php.net/count.

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: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211 


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.545 / Virus Database: 339 - Release Date: 27/11/2003
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.545 / Virus Database: 339 - Release Date: 27/11/2003
 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to