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

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -