mysql - PHP : Dropdown not insert into table -
i have form form contains textfield , dropdown menu . problem , after fill in field , select option . data textfield inserted table on db . selected option not inserted db . checked code , can't find error.. please me out . .
form :
<tr> <td colspan="2"><strong>name</strong> <div id="div_nama"><input name="txt_nama" type="text" id="txt_nama" onchange="validate()" size="40" /> </div> </td> </tr> <tr> <td><strong>kod masco</strong> <div id="div_kod_masco"><select name="txt_kod_masco" id="txt_kod_masco"> <option>sila pilih</option> <?php $sql = " select * lstmasco order kod asc"; $res_kod = mysql_query($sql); while($row_kod = mysql_fetch_array($res_kod)){ ?> <option value="<?php echo strtolower($row_kod['nama']); ?>"><?php echo ($row_kod['kod']); ?></option> <?php } ?> </select> </div></td></tr>
i shortened form code out .
mysql query:
$sql = "insert jobseeker(`no_kp`, `tahun_lahir`, `nama`, `alamat`, `poskod`, `daerah`, `negeri`, `kod_masco`, `kod_lesen`, `tel_bimbit`, `tel_rumah`, `email`, `jantina`, `status`, `sumber`, `dt_daftar`, `active`) values('".strtolower($nokp_edited)."', '".$year."', '".addslashes(strtoupper($_post['txt_nama']))."', '".addslashes(strtoupper($_post['txt_alamat']))."', '".$poskod."', '".$daerah."', '".$negeri."', '".addslashes($_post['txt_kod_masco'])."', '".addslashes($_post['txt_kod_lesen'])."', '".addslashes($_post['txt_tel_bimbit'])."', '".addslashes($_post['txt_tel_rumah'])."', '".addslashes($_post['txt_email'])."', '".addslashes($_post['txt_jantina'])."', '".addslashes($_post['txt_status'])."', '".addslashes($_post['txt_sumber'])."', '".date('y-m-d')."', '".$active."')"; $res_updjobseeker = mysql_query($sql); $no_kp = strtolower($nokp_edited);
you don't have value on first "option". if select "sila pilih" dropdown, value sent server null.
Comments
Post a Comment