0% found this document useful (0 votes)
9 views

HTML Deuxieme

Uploaded by

firancemafutaweb
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

HTML Deuxieme

Uploaded by

firancemafutaweb
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

html>

<head>

</head>

<body>

<form action = "<?php print $_SERVER['PHP_SELF'];?>" method = "post">

Valeur 1:

<input type = "text" name = "val1" size = "10">

Valeur 2:

<input type = "text" name = "val2" size = "10">

Opération:

<input type = "radio" name = "operation" value = "add"> Addition

<input type = "radio" name = "operation" value = "sous"> Sustraction

<input type = "radio" name = "operation" value = "mul"> Multiplication

<input type = "radio" name = "operation" value = "div"> Division

<hr />

<input type = "submit" value = "Calculate">

<input type = "reset" value = "Clear"></form>

</body>
</html>

<?php

if(isset($_POST['val1'])&#038;&isset($_POST['val2'])&#038;&isset($_POST['operation']))

$val1 = $_POST['val1'];

$val2 = $_POST['val2'];

$operation = $_POST['operation'];

if( is_numeric( $val1 ) &#038;& is_numeric( $val2 ) )

if( $operation != null )

switch( $operation )

case "add" : $result = $val1 + $val2; break;

case "mul" : $result = $val1 * $val2; break;

case "sous" : $result = $val1 - $val2; break;

case "div" : $result = $val1 / $val2; break;

echo( "Résultat de Calcul:<b> $result</b>" );

else
{

echo( "Données invalide, veillez ré-essayer ");

?>

You might also like