dimanche 20 décembre 2020

Conditional PHP Code Not Accepting Values

I have the following PHP code that doesn't seem to work properly in the conditional part. I am able to properly get the inputs from the user for the three sides of the triangle, but the IF statement is not doing what it's supposed to be doing - any ideas??

<?php

echo "Thank you for the input.  ";
echo "You entered in the following values: ".$_GET["firstSide"].", ".$_GET["secondSide"],", and ".$_GET["thirdSide"]." "; 


$int_firstSide = @$_GET["firstSide"];
$int_secondSide = @$_GET["secondSide"];
$int_thirdSide = @$_GET["thirdSide"];

$oneAndtwo = $int_firstSide + $int_secondSide;
$oneAndthree = $int_firstSide + $int_thirdSide;
$twoAndthree = $int_secondSide + $int_thirdSide;

if((($oneAndtwo) > ($int_thirdSide)) || (($oneAndthree) > ($int_secondSide)) || (($twoAndthree) > ($int_firstSide)))
{
    echo "  Based on the entered values, you indeed have a Triangle...";
} else {
   echo "You do not have a valid Triangle...Sorry...have a nice day and thanks for playing!";
}


?>

Aucun commentaire:

Enregistrer un commentaire