2
Answers

Error while inserting records in db through Mysqli

Dear Sir, below is my php code for inserting records in database.
 
<? php
If (isset ($_POST ['btn_register'])){
extract ($_POST);
$query_string = "insert into tbl_user_profile
(`cand_id`,`cand_profile`,`cand_fname`,`cand_mname`,`cand_lname`,`cand_dob`,`cand_dob_time`,`cand_kul`,`cand_gender`,`cand_height_f`,`cand_height_i`,`cand_edu`,`cand_occ`,`cand_m_stat`,`cand_f_fname`,`cand_f_mname`,`cand_f_lname`,`cand_m_fname`,`cand_m_mname`,`cand_m_lname`,
`cand_mob`,`cand_mob_sec`,`cand_add`,`cand_tal`,`cand_dist`,`cand_state`,`cand_u_fname`,`cand_u_mname`,`cand_u_lname`,`cand_u_kul`,`user_regon`)
values('$Profile_Other','$txt_fname','$txt_mname','$txt_lname','$txt_age','$txt_time','$txt_kul','$rdo_gender','$txt_h_feet','$txt_h_inch','$txt_education','$txt_occupation','$cmb_marital_status','$txt_f_fname','$txt_f_mname','$txt_f_lname','$txt_m_fname','$txt_m_mname','$txt_m_lname','$txt_mobile','$txt_sec_mobile','$txt_add','$txt_tal','$txt_dist','$cmb_state','$txt_u_fname','$txt_u_mname','$txt_u_lname','$txt_u_kul',NOW())";
echo $query_string;
if($mylib->executeQuery($query_string)==1){
$mylib->displayMessage('Done','Records saved Successfully','success');
}else{
$mylib->displayMessage('Affs',mysqli_error($mylib->con),'danger');
}
//header('location: index');
}
?>
 
And this is my HTML code to insert the gender value.
 
<tr>
<td>Gender</td>
<td>
<input type="radio" name="rdo_gender" value="1" />Male
<input type="radio" name="rdo_gender" value="0" />Female
</td>
</tr>
 
i got the error that undefined variable 'rdo_gender'. Please help 
Answers (2)