qwerty234 Posted May 3, 2007 Share Posted May 3, 2007 How can I determine the values of a listbox, both unselected or selected after submitting the form: <select name="sel1" size="10" multiple="multiple"> <? PHP code populates listbox ?> </select> Do I have to use Javascript to determine the contents, like in the pseudo code Javscript below. But how would you pass the Javascript return value to PHP? function listBoxContents(sel1) { var selLength1 = sel1.length; var valuesPresent1 = new Array(sel1.length-1); var i; for(i=0; i<=selLength1-1; i++) { valuesPresent1[i]=sel1.options[i].valueOf(); } return valuesPresent1; } Link to comment https://forums.phpfreaks.com/topic/49753-determine-contents-of-listbox/ Share on other sites More sharing options...
DaveEverFade Posted May 3, 2007 Share Posted May 3, 2007 You could try putting the results in a hidden field (using javascript) then submit the form? You might have problems with an array there so if I were you i'd concatenate the values of the select box (using somthing like |) then explode the results on the PHP page. Link to comment https://forums.phpfreaks.com/topic/49753-determine-contents-of-listbox/#findComment-244099 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.