Make external value calculations ($ _GET) [duplicate]

-1

Good afternoon, I'm new to php, and I'm doing some exercise, but I can not do an exercise that asks to do sum, split, multiplication or subtraction depending on the values entered in $ _GET, but using elseif? I leave an image of the exercise, because they are two points, the first part I have already done, the second I do not understand how to do!

    
asked by anonymous 05.07.2016 / 16:40

1 answer

-1

You can do this as follows.

Exercise 1

$num1 = $_GET['num1'];
$num2 = $_GET['num2'];

if(($num1 != null) AND ($num2 != null)){

   $result = $num1 + $num2;
   echo "o resulto da soma dos números é: $result";

}else{
   echo "Os valores não foram informados, por favor tente novamente.";
}
    
05.07.2016 / 16:47