maliary Posted June 18, 2007 Share Posted June 18, 2007 Am trying to insert data into a mysql database from a multiple select list. How would i do this? $count =0; <select name=test_param".$count." size=3 multiple><option value=''> Select Test(s) </option>"; $disp =$db->Execute( "SELECT * FROM care_test_param WHERE group_id ='$group_id'"); while($pow= $disp->FetchRow()) { $testparam.='<option value="'.$pow['name'].$count.'">' . $pow['name']. '</option>'; $count ++; } </select> This isn't working. It only captures the last value selected.How can i get all the values selected inserted? Quote Link to comment https://forums.phpfreaks.com/topic/56016-insert-data-from-multiple-select-list/ Share on other sites More sharing options...
jeeva Posted June 18, 2007 Share Posted June 18, 2007 You can change the name of the select box like "name[]". so that you can get as an array value. i guess it will help u...... <select name="test_param[]" size=3 multiple><option value=''> Select Test(s) </option>"; $disp =$db->Execute( "SELECT * FROM care_test_param WHERE group_id ='$group_id'"); while($pow= $disp->FetchRow()) { $testparam.='<option value="'.$pow['name'].$count.'">' . $pow['name']. '</option>'; $count ++; } </select> ...jeeva Quote Link to comment https://forums.phpfreaks.com/topic/56016-insert-data-from-multiple-select-list/#findComment-276712 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.