Page 1 of 1
posting a multiple select
Posted: Tue Aug 19, 2003 6:19 am
by Vantuykom
I'm having a little problem, in my form, I have to select multiple lines in a 'select' field and post it for processing.
Now in the $_POST-variable, there is only the last selected item visible.
How can I post every selected line?
thanx a lot
Posted: Tue Aug 19, 2003 7:23 am
by jollyjumper
Hi Vantuykom,
Try something like this(the name with the []):
<select multiple name="myname[]">
.....
</select>
You should receive an array in php now, instead of the last item.
Greetz Jolly.
Posted: Tue Aug 19, 2003 7:27 am
by Vantuykom
thanx a lot

Posted: Tue Aug 19, 2003 7:43 am
by jollyjumper
You're welcome, btw you can do this with more form fields than a multiple select. You can also insert multiple textboxes with myname[] and it will be an array in php. But a disadvantage about this method is that you can't use document.forms['myform'].myname.value anymore. A workaround for this is giving the textbox an id and use document.getElementById
Greetz Jolly.