how to show selected multiple options of drop down in php

Journey With Me

I have to store the Multiple values from drop down list into db

I want retrieve the those value and display into the drop down list


first u get that value explode those value into one variable


use in-array function function in to check ,whether the value selected or not

<?php if(in_array($row[‘id’],$p_language_code)){echo “selected=selected”;}else{echo “”;}?>>


<select class="inputtext" style="width:190px;" name="pro_mother_tongue[]" size="1" id="pro_mother_tongue" multiple="multiple" >
              <option value="">--Select Mother Tongue--</option>
            //split the language list
            $mother_toue=mysql_query("SELECT * FROM mother_tongue")or die(mysql_error());
                    <option value="<?php  echo $row['id'];?>" <?php if(in_array($row['id'],$p_language_code)){echo "selected=selected";}else{echo "";}?>><?php  echo $row['language'];?></option>                

View original post