Jump to content

Insert data from multiple select list


maliary

Recommended Posts

 

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?

Link to comment
https://forums.phpfreaks.com/topic/56016-insert-data-from-multiple-select-list/
Share on other sites

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.