naveed.qasim Posted August 29, 2010 Share Posted August 29, 2010 Hi! every body. This is my first post in this form. Hope u people will help me. I'm using PHP 5.3. I've the following listboxes. From "emp_list" i've double click the value, which goes to "sel_list". I'm selecting multiple values. How can i get these values on the target page using PHP. <html><head> <script language="javascript"> function moveItem( box1, box2 ){ for ( var i=0; i < box1.options.length; i++ ){ if ( ( box1.options.selected == true ) ){ strItemToAdd = box1.options.text; box2.options[box2.length] = new Option(strItemToAdd); box1.options = null; i--; } } } </script> </head><body> <form id="project" name="project" action="" method="POST"> <select id='emp_list' name='emp_list' size='5' STYLE="width:170;" multiple onDblclick="moveItem( project.emp_list, project.sel_list)"> <option value='a1'>a1</option> <option value='a2'>a2</option> <option value='a3'>a3</option> </select> <select id='sel_list' name='sel_list' size='5' STYLE="width:170;" multiple onDblclick="moveItem(project.sel_list, project.emp_list )"> </select> <input type='submit' name='submit' value='submit'> </form> </body></html> Link to comment https://forums.phpfreaks.com/topic/211988-how-to-getting-the-following-listbox-data/ Share on other sites More sharing options...
csplrj Posted August 29, 2010 Share Posted August 29, 2010 I guess pls set the name from name='emp_list' to name='emp_list[]' CSJakharia Link to comment https://forums.phpfreaks.com/topic/211988-how-to-getting-the-following-listbox-data/#findComment-1104876 Share on other sites More sharing options...
naveed.qasim Posted August 29, 2010 Author Share Posted August 29, 2010 i've tried that but the problem is that when the values moves to sel_list[], & i then select them all and click on submit, only then the other page know what is in that box. Link to comment https://forums.phpfreaks.com/topic/211988-how-to-getting-the-following-listbox-data/#findComment-1104947 Share on other sites More sharing options...
wildteen88 Posted August 29, 2010 Share Posted August 29, 2010 You need to name sel_list as sel_list[] too. $_POST['sel_list'] will be an array of selected items. Link to comment https://forums.phpfreaks.com/topic/211988-how-to-getting-the-following-listbox-data/#findComment-1104961 Share on other sites More sharing options...
naveed.qasim Posted August 29, 2010 Author Share Posted August 29, 2010 Yes, I've changed the name but on the other page it only knows the values, if i select all the values in the sel_list[] box, but i want all the values which i've moved to teh sel_list[] on the other page Link to comment https://forums.phpfreaks.com/topic/211988-how-to-getting-the-following-listbox-data/#findComment-1105023 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.