My code is like this below
HTML Code :
<select multiple="multiple" size="5" name="religion[]" id="religion" class="txtareamultifield" ondblclick="moveOptions(document.MatriForm.religion,document.MatriForm.RIGHTRELIGION,1);fnAnyChk(document.MatriForm.religion,document.MatriForm.RIGHTRELIGION);fnGothraChk();fnModifySubCasteChk(this.value);otherreligion();" style="width:355px; height:90px; font-size:13px;">
<option value="" selected>Any</option>
<option value="Hindu">Hindu</option>
<option value="Muslim-Shia">Muslim - Shia</option>
<option value="Muslim-Sunni">Muslim - Sunni</option>
<option value="Muslim-Others">Muslim - Others</option>
<option value="Christian-Catholic">Christian - Catholic</option>
<option value="Christian-Orthodox">Christian - Orthodox</option>
<option value="Christian-Protestant">Christian - Protestant</option>
<option value="Christian-Others
">Christian - Others</option>
<option value="Sikh">Sikh</option>
PHP Code :
$religion=$_POST['religion'];
if(isset($religion)){
//$rel=explode(':',$_POST["religion_".$i]);
//$rel=implode(',',$religion);
$serializedoptions1 = serialize($religion);
$serializedoptions123 = unserialize($serializedoptions1);
//print_r($serializedoptions123);
foreach($religion as $key=>$val){
echo $val;
}
}
$qry1="insert into preference(id,email,toage,fromage,maritalstatus,toheight,fromheight,phc,religion,star,caste, mangalik,mothertongue,qualification,occupation,income,country,state,city,citizenship,food, smoking,drinking,partner_desc)
VALUES('','" . $_SESSION['user'] . "','$toage','$fromage','$maritalstatus','$toheight', '$fromheight','$phc','".implode(',',$serializedoptions123)."','$serializedoptions2','$serializedoptions','$mangalik','$serializedoptions3', '$serializedoptions8','$serializedoptions9','$income','$serializedoptions4','$serializedoptions5','$serializedoptions6','$serializedoptions7','$food','$smoking','$drinking','$description')";
mysql_query($qry1) or die(mysql_error());