php - Input Type Radio Button Undefined Index -
$sel=""; $suc=""; $gend=""; $male=""; $female=""; $selected_radio=""; if(isset($_post['save'])) { $e=0; $selected_radio = $_post['gender']; if($selected_radio!="") { if ($selected_radio == 'male') { $male = 'checked'; } else if ($selected_radio == 'female') { $female = 'checked'; } } else { $sel="select gender"; $e=1; } if($e==0) { $suc="success"; $male =""; $female =""; } }
without selecting option/radio button, when click "save" (submit button)., showing "undefined index: gender". error msg appearing "select gender". when select 1 option(male/female), appearing msg.("success").
so please me find solution
$sel=""; $suc=""; $gend=""; $male=""; $female=""; $selected_radio=""; if(isset($_post['save']) && isset($_post['gender'])) { $e=0; $selected_radio = $_post['gender']; if ($selected_radio == 'male') { $male = 'checked'; } else if ($selected_radio == 'female') { $female = 'checked'; } } else { $sel="select gender"; $e=1; } if($e==0) { $suc="success"; $male =""; $female =""; }
Comments
Post a Comment