20 Avril
This commit is contained in:
24
BACKEND/PHP/tp2/ex3/include/controller.php
Normal file
24
BACKEND/PHP/tp2/ex3/include/controller.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
$nbr1=$_POST['op1'];
|
||||
$nbr2=$_POST['op2'];
|
||||
$ope=$_POST['operation'];
|
||||
if ($ope=="+"){
|
||||
$resultat=$nbr1+$nbr2;
|
||||
echo "<h3> Le resultat est $resultat </h3>";
|
||||
}
|
||||
if ($ope=="-"){
|
||||
$resultat=$nbr1-$nbr2;
|
||||
echo "<h3> Le resultat est $resultat </h3>";
|
||||
}
|
||||
if ($ope=="x"){
|
||||
$resultat=$nbr1*$nbr2;
|
||||
echo "<h3> Le resultat est $resultat </h3>";
|
||||
}
|
||||
if ($ope=="/"){
|
||||
if($nbr2==0){
|
||||
die("<h2> Division par 0 </h2>");
|
||||
}
|
||||
$resultat=$nbr1/$nbr2;
|
||||
echo "<h3> Le resultat est $resultat </h3>";
|
||||
}
|
||||
?>
|
Reference in New Issue
Block a user