View Full Version : Repeated name fields, How?

Creative Insanity
03-21-2006, 06:00 AM
Ok we all know that the common formail option is pretty simple stuff, but what about a form mail from items from a repeat region. Since the common contact php script gets it's info from the field names.. but a repeat region duplicates a feild name in order to display them like thus:
<td width="55%" height="25">

<font face="verdana" size="1" color="black">
<input type="text" name="item" value="Cubase SX DVD" readonly="yes" size="40" border="no">
<td width="20%" height="25">
<font face="verdana" size="1" color="black">
../images/euro.gif35.00 </font>
<td width="10%" height="25">

<font face="verdana" size="1" color="black">

<td width="55%" height="25">
<font face="verdana" size="1" color="black">
<input type="text" name="item" value="danDont Shirt LS Black" readonly="yes" size="40" border="no">
So how would you get it to pick up repeatedly named fields instead of just the last one?
I have been racking the brain on this one all day.

Creative Insanity
03-21-2006, 06:39 AM
So simple.. I was looking at it from the wrong angle.. it is SO SIMPLE.
So what did I do.. tell ya.

I set up a varible $item =0

Then in here name="item" I just changed to name="<? echo $item = $item +1; ?> and that just names the field names for the contact form to 1 2 3 4 5 6 from the repeat region which the contact form picks up because of the differant names.. sooo simple.

03-21-2006, 01:06 PM

simple as simon

i normaly would use a default name like field...(where field would become email or address or whatever
<? echo "field".$item = $item +1; ?>

so it would become...


this helps if you want to target another field which loops using the same method

but if you have cracked it then thats great too

Creative Insanity
03-21-2006, 06:36 PM
Yeah.. since this was items from a cookie generated cart I have the mail as
Item 1
Item 2
Item 3
Item 4

Works a treat.

Now just gotta figure out why paypals cancel_return varible does not work as they say it should. Once that is sussed I have finished reinventing the wheel. LOL