forked from monnerat/web_2025
ex3
This commit is contained in:
parent
d82343a051
commit
ca49c90ffa
@@ -1,34 +1,59 @@
|
||||
<?php
|
||||
include 'include/controller.php';
|
||||
include_once 'include/controller.php';
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title></title>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css"
|
||||
/>
|
||||
<link rel="stylesheet" href="./css/style.css">
|
||||
</head>
|
||||
<body>
|
||||
<main class="container">
|
||||
<h3>Calculatrice</h3>
|
||||
<form method="POST">
|
||||
<div class="grid">
|
||||
<input placeholder="un nombre" type="number" step="any" name="op1" value ="" required>
|
||||
<select name="operation" required>
|
||||
<option value="+">+</option>
|
||||
<option value="-">-</option>
|
||||
<option value="x">x</option>
|
||||
<option value="/">/</option>
|
||||
</select>
|
||||
<input placeholder="un nombre" type="number" step="any" name="op2" required>
|
||||
<button type="submit" name="soumis"> Calculer</button>
|
||||
</grid>
|
||||
</form>
|
||||
</main>
|
||||
</body>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Exercice 3</title>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="https://cdn.jsdelivr.net/npm/@picocss/pico.min.css"
|
||||
/>
|
||||
<link rel="stylesheet" href="./css/style.css">
|
||||
</head>
|
||||
<body>
|
||||
<main class="container">
|
||||
<h3>Calculatrice</h3>
|
||||
<form method="POST">
|
||||
<div class="grid">
|
||||
<input
|
||||
placeholder="un nombre"
|
||||
type="number"
|
||||
step="any"
|
||||
name="op1"
|
||||
value="<?php echo htmlspecialchars($valeurOp1, ENT_QUOTES, 'UTF-8'); ?>"
|
||||
required
|
||||
>
|
||||
<select name="operation" required>
|
||||
<option value="+" <?php echo $operation === '+' ? 'selected' : ''; ?>>+</option>
|
||||
<option value="-" <?php echo $operation === '-' ? 'selected' : ''; ?>>-</option>
|
||||
<option value="x" <?php echo $operation === 'x' ? 'selected' : ''; ?>>x</option>
|
||||
<option value="/" <?php echo $operation === '/' ? 'selected' : ''; ?>>/</option>
|
||||
</select>
|
||||
<input
|
||||
placeholder="un nombre"
|
||||
type="number"
|
||||
step="any"
|
||||
name="op2"
|
||||
value="<?php echo htmlspecialchars($valeurOp2, ENT_QUOTES, 'UTF-8'); ?>"
|
||||
required
|
||||
>
|
||||
<button type="submit" name="soumis">Calculer</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php if ($messageErreur !== '') : ?>
|
||||
<p><?php echo htmlspecialchars($messageErreur, ENT_QUOTES, 'UTF-8'); ?></p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($aCalcule) : ?>
|
||||
<p>
|
||||
Résultat :
|
||||
<?php echo htmlspecialchars($valeurOp1, ENT_QUOTES, 'UTF-8'); ?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user