23 lines
445 B
PHP
23 lines
445 B
PHP
<?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;
|
|
}
|
|
}
|
|
}
|
|
?>
|
|
|