Monday, January 16, 2006

I have to make a note of this as it has taken me days to track down how to do it. I have been looking for a way inside a for loop to loop 3 input fields named name1,name2 and name3.

I was looking for an equivalent to the actionscript: this["name"+i] and have just been shown a way of doing it, now I don't know if this is the correct way but it works a treat for me:

for ($i = 1; $i <= 3; $i++) {
$nameinsert = ${'name'.$i};
}

Jon 3:53 PM Permalink

Comments:

If you use

input type="text" name="field[0]" /
input type="text" name="field[1]" /
input type="text" name="field[2]" /

You data becomes an array

Post a Comment