|
Posted by Jonathan N. Little on 02/07/06 16:53
Stanch wrote:
> Not sure what you're trying to achieve (javascript issues?), but if
> it's of any help, you can do name[] and make it into an array.
>
> e.g. <select name="name[]"></select>
>
> Using name[] you can have multiple selects/inputs with the same form
> name.
>
Actually the brackets in the name is needed if the receiving script is PHP
<form_element name="some_name[]" ...
but not needed for Perl or JavaScript
<form_element name="some_name" ...
> However, of course it's best if you use distinct names to tell them
> apart.
Can be very usefully on a form that collects like data but the quantity
is unknown. Say for instance an order form {PHP example}
1st item
<input type="text" name="item[]">
<input type="text" name="price[]">
<input type="text" name="qty[]">
<input type="text" name="amount[]">
2nd item
<input type="text" name="item[]">
<input type="text" name="price[]">
<input type="text" name="qty[]">
<input type="text" name="amount[]">
....
nth item
<input type="text" name="item[]">
<input type="text" name="price[]">
<input type="text" name="qty[]">
<input type="text" name="amount[]">
count the elements in the array, iterate though them and build up an
order...
--
Take care,
Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
Navigation:
[Reply to this message]
|