View Full Version : POSTing an entire listbox

08-03-2008, 04:22 PM
Can someone help me here? I've got a listbox that im dynamically changing on my page (part of a form) and when I click the submit button I want to post all the contents of the listbox whether or not they're selected. Do I have to build a new variable in javascript to pass along or is there some way I can do this in PHP?

08-03-2008, 04:54 PM
You could use multiple="multiple" attribute with the select tag, so that users can select more than one option by clicking the Ctrl key. (http://www.webmasterworld.com/forum91/1799.htm)

With the help of javascript you can automate the "select all" procedure, see http://www.qodo.co.uk/blog/javascript-select-all-options-for-a-select-box/

08-03-2008, 06:17 PM
I want to submit all the contents whether selected or not. Am I going to have javascript select all the contents or can i post the list box as an array regardless?

08-03-2008, 06:30 PM
You need to select the options (somehow) to get posted on submit.

08-03-2008, 06:34 PM
ok thanks. there is one other thing ive just noticed. I had a working page where i could transfer options between listboxes that stopped working when i put the listboxes in a form. I was accessing the listboxes with their names using GetElementById --- do i need to change that now thier in a form?