update
This commit is contained in:
22
DEV.2.2/TP/TP2/ex3.php
Normal file
22
DEV.2.2/TP/TP2/ex3.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php //première version
|
||||
$op1 = $_POST['op1'];
|
||||
$op2 = $_POST['op2'];
|
||||
$operation = $_POST['operation'];
|
||||
if($soumis){
|
||||
if($operation == '/' && $op2 == 0) {
|
||||
echo"<h3>On ne peut pas diviser par 0.</h3>";
|
||||
exit();
|
||||
} else {
|
||||
if($operation == '+') {
|
||||
$res = $op1+$op2;
|
||||
} elseif ($operation == '-') {
|
||||
$res = $op1-$op2;
|
||||
} elseif ($operation == 'x') {
|
||||
$res = $op1*$op2;
|
||||
} elseif ($operation == '/') {
|
||||
$res = $op1/$op2;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
Reference in New Issue
Block a user