Why isn’t my if else statement is not working ? the output that is giving is Zero

<?php

$conn = mysqli_connect(‘localhost’ , ‘root’ , ” , ‘physical’) or die(mysqli_error($conn));

if(isset($_POST[‘formBtn’])) {

$name = $_POST[‘name’];
$birthdate = $_POST[‘birthdate’];
$gender = $_POST[‘gender’];
$unit = $_POST[‘unit’];
$class = $_POST[‘class’];
$age = $_POST[‘age’];
$push1 = $_POST[‘push1’];

$percentage1 = 0;
$push1_init = 0;
$pull1_init = 0;
$push1_init1 = 0;
$pull1 = 0;
$total = 0;
$finalRating = 0;

if ($age <= 29) {
echo $push1_init == 40;

}

elseif ($age >= 30 && $age <= 34) {

echo $push1_init == 35;

}

elseif ($age >= 35 && $age <= 39) {

echo $push1_init == 30;

}

elseif ($age >= 40 && $age <= 44) {

echo $push1_init == 25;

}

elseif ($age >= 45 && $age <= 49) {

echo $push1_init == 20;

}

elseif ($age >= 50 && $age >= 75) {

echo $push1_init == 15;

}

$push1_init1 = (($push1 – $push1_init)*2) + 65;
$total = ($push1_init1);
$finalRating = ($total * 0.05);

$addHouses = mysqli_query($conn , “Insert into houses values(null , ‘$name’ , ‘$age’ , ‘$birthdate’ , ‘$gender’ , ‘$unit’ , ‘$class’ , ‘$push1’ , ‘$push1_init’ , ‘$total’ , ‘$finalRating’ )”) or die(mysqli_error($conn));

$age = “”;
$selectAge = mysqli_query($conn , “Select * from age where id = ‘$age'”) or die(mysqli_error($conn));
while($row = mysqli_fetch_array($selectAge)) {

$age = $row[‘age’];

}

if($addHouses) {
echo ‘
<script>
alert(“Data Inserted”);
window.location.href = “male.php”;
</script>
‘;
}

}
?>

Read more here:: Why isn’t my if else statement is not working ? the output that is giving is Zero

Leave a Reply

Your email address will not be published. Required fields are marked *