<html xmlns="<a href="http://www.w3.org/1999/xhtml" target="_blank">http://www.w3.org/1999/xhtml</a>" xml:lang="fr" lang="fr">
<head>
<title>Addition</title>
</head>
<body>
<?php
if( empty($_GET) or ( empty($_GET['a']) and empty($_GET['b']) ) )
{
?>
<!-- Debut du formulaire -->
<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="GET" name="formulaire_addition">
<fieldset>
<legend>Additionner :</legend>
<p>
<label>Premier nombre : </label>
<input name="a" type="text" id="a" />
<br />
<label>Second nombre : </label>
<input name="b" typ e="text" id="b" />
<br />
<input type="submit" value="Calculer" />
</p>
</fieldset>
</form>
<!-- Fin du formulaire -->
<?php
} else
{
?>
<!-- Debut de la réponse -->
<fieldset>
<legend>Résultat :</legend>
<p>
<?php
$a = $_GET['a'];
$b = $_GET['b'];
$c = $a + $b;
echo "" . $a . " + " . $b . " = " . $c;
?>
</p>
</fieldset>
<!-- Fin de la réponse -->
<?php
}
?>
</body>
</html>
Chez moi ça marche très bien ...