The Little Guy Posted July 25, 2011 Share Posted July 25, 2011 I have two multi select boxes, when you select members on the left and press "->" to move them to the right select box it adds them to the second select box. if you press "<-" it removes them from the second select box and adds them to the first one. When a user has added everything to the second select box, how can I post those? None have been selected so it doesn't show on the second page after the form gets submitted. do I have to add them to a hidden field? Quote Link to comment https://forums.phpfreaks.com/topic/242780-submit-multi-select-selection-box/ Share on other sites More sharing options...
Psycho Posted July 25, 2011 Share Posted July 25, 2011 You have a couple of options that come to mind. 1. When the user adds/removes the values you can update a hidden field with the selected values 2. You can add an onsubmit event to automatically select all the options in the "selected" list. (be sure to name the select list as an array) #2 is the easiest to implement in my opinion. But, I personally prefer #1 EDIT: Moving to the JavaScript forum Quote Link to comment https://forums.phpfreaks.com/topic/242780-submit-multi-select-selection-box/#findComment-1246965 Share on other sites More sharing options...
AbraCadaver Posted July 25, 2011 Share Posted July 25, 2011 Without submitting the page each time you add or remove, you'll need some AJAX: 1. You could have an onsubmit that selects all and then submits 2. You could have an onclick that adds each one as a hidden field and also adds it to the second box 3. You could use some ajax on the add remove buttons that calls a PHP script with the selected value and add it to the session Quote Link to comment https://forums.phpfreaks.com/topic/242780-submit-multi-select-selection-box/#findComment-1246967 Share on other sites More sharing options...
AbraCadaver Posted July 25, 2011 Share Posted July 25, 2011 EDIT: Moving to the JavaScript forum Thought I was going crazy! After I posted I was in the JS forum Quote Link to comment https://forums.phpfreaks.com/topic/242780-submit-multi-select-selection-box/#findComment-1246968 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.