Programmers learn & share
16 views

Solution:

STEP 1: Using a comma seprated store it to an array and save the files

Code:

<label for="aoi">Area of Interest:</label>
          <select id="sel_aoi" name="aoi[]" multiple="multiple">
            <option value="hr-executive">HR Executives</option>
            <option value="sr-manager">Sr. Manager</option>
            <option value="service-advisor">Service Advisor</option>
            <option value="production">Production Engineer</option>
            <option value="mechanical">Mechanical Engineer</option>
          </select>

 

STEP 2: process.php

$aoi = implode(',', $_POST['aoi']);

 

STEP 3: At the time you get values from your $_POST insert them with a MySQL insert multiple values

Code:

insert into myTable 
    (someColumn, someOtherColumn) 
values 
    (someValue1, someOtherValue1), 
    (someValue2, someOtherValue2), 
    (someValue3, someOtherValue3)

 

STEP 4: In case PHP implode ()

$qry="insert into mytable (someColumn) values (".implode(',',$myArray).")

 

posted May 19 in php by (10,020 points)   | 16 views
2,220 questions
2,691 answers
59 comments
241 users