javascript - Multiple select not working while submiting please give me to select multiple option code -


<form method='post' action=''>    <select name='select1' multiple="true">      <option value='1' <?php if(isset($_post[ 'select1'])) { if($_post[ 'select1']=='1' ) { echo 'selected'; } } ?>>imtiyaz</option>      <option value='2' <?php if(isset($_post[ 'select1'])) { if($_post[ 'select1']=='2' ) { echo 'selected'; } } ?>>narendra</option>      <option value='3' <?php if(isset($_post[ 'select1'])) { if($_post[ 'select1']=='3' ) { echo 'selected'; } }?>>shekar</option>    </select><br><br><br>      <select name='select2' multiple>      <option value='1' <?php if(isset($_post[ 'select2'])) { if($_post[ 'select2']=='1' ) { echo 'selected'; } } ?>>sumit</option>      <option value='2' <?php if(isset($_post[ 'select2'])) { if($_post[ 'select2']=='2' ) { echo 'selected'; } } ?>>arun</option>      <option value='3' <?php if(isset($_post[ 'select2'])) { if($_post[ 'select2']=='3' ) { echo 'selected'; } } ?>>vinay</option>    </select><br><br><br>      <select name='select3' multiple>      <option value='1' <?php if(isset($_post[ 'select3'])) { if($_post[ 'select3']=='1' ) { echo 'selected'; } } ?>>rohth</option>      <option value='2' <?php if(isset($_post[ 'select3'])) { if($_post[ 'select3']=='2' ) { echo 'selected'; } } ?>>pawan</option>      <option value='3' <?php if(isset($_post[ 'select3'])) { if($_post[ 'select3']=='3' ) { echo 'selected'; } } ?>>suresh</option>    </select>      <input type='submit' value='submit' name='submit'>  </form>

my mutiple select box not working while submiting form , want display values in select box after refresh page have selected

try this:

<select name='select1[]' multiple= "true"> 

the name of multi select drop down must array can accept multiple selected value in it. can use iterating array using foreach() like:

foreach($_request['select1'] $selection) {     // code } 

Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -