[thelist] http://www.orchardsweb.com/webmail/

.jeff jeff at members.evolt.org
Wed Oct 30 04:22:01 CST 2002


dunstan,

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> From: 1976 design
>
> > well, for client-side scripting to behave, form field
> > names should be follow the rules for creating a valid
> > variable name -- begin with a letter, _, or $ and
> > contain only letters, numbers, _, and $.
>
> mine conform to that ok.
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

except that they also contain the characters [ & ].

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> I originally inserted the unique $imageid vaalue after
> each field name, so:
>
> <input type="text" size="2" maxlength="2"
>        name="$size1$imageid" value="$size1" />
>
> If that satisfies your unique naming of each field
> requirement, could you possibly tell me two things
> please:
>
> [1] If I'm not using the [] how do I pass this stuff to
>     an array? I've only found examples using the []
>     method.
>
> [2] It's all useless without getting that $imageid
>     variable into the array for each row... any
>     ideas on that?
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

well, i don't know php, so i'll have to stick with pseudo-code that
represents how i might tackle it with my server-side language of choice --
coldfusion.  what i'd probably do is make each type of field uniquely named
by appending it with an underscore and then that elements position in the
array stored in memory.  i'll use the example with a quantity field.

let's say we've got 7 items in our cart.  we'd end up with 7 uniquely named
quantity fields -- quantity_1, quantity_2, ..., quantity_6, quantity_7.
now, rather than futzing around with an array server-side (since it'd be
kinda pointless), i'd simply do a loop and accessing the form appropriate
quantity field with bracket notation (not sure how it works in php) --
form['quantity_' & i].

does that help?

.jeff

http://evolt.org/
jeff at members.evolt.org
http://members.evolt.org/jeff/




More information about the thelist mailing list