• Register


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


<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>


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


insert into myTable 
    (someColumn, someOtherColumn) 
    (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 31,120 points