如何比较变量中的值与字符串

i have the following code but it dosen't seem to work

the html:

    <input class="radio_1" type="radio" name="radio_group_1" value="Male">
    <label for class="gender_male" ="radio_1">Male</label>  

    <input class="radio_2" type="radio" name="radio_group_1" value="Female"> 
    <label for class="gender_female" ="radio_2">Female</label>

the php:

  $gender=mysqli_escape_string($db,$_POST['radio_group_1']);//gender

the following code dosen't seem to work

 if($gender=="male")
{
$profile_photo = "profile_photo_encrypt/male.jpg";
}
if($gender=="female")
{
$profile_photo = "profile_photo_encrypt/female.jpg";
 } 

Use this .. Case Sensitivity is the problem

    if($gender=="Male")
{
$profile_photo = "profile_photo_encrypt/male.jpg";
}
if($gender=="Female")
{
$profile_photo = "profile_photo_encrypt/female.jpg";
 } 

As stated, case sensitivity is the issue here.

To avoid issues with case sensitivity you can use strcmp. Using this function will compare 2 strings and return 0 if they match.

if(strcmp($gender, "Male") == 0)
{
    $profile_photo = "profile_photo_encrypt/male.jpg";
}

if(strcmp($gender, "Female") == 0)
{
    $profile_photo = "profile_photo_encrypt/female.jpg";
}

You might also consider a switch statement and make your text lowercase first using strtolower

switch(strtolower($gender))
{
    case "male": $profile_photo = "profile_photo_encrypt/male.jpg"; break;
    case "female": $profile_photo = "profile_photo_encrypt/female.jpg"; break;
}