The Wiki World Portal: Difference between revisions

From MediaWiki
Jump to navigationJump to search
Line 46: Line 46:
</HTML>
</HTML>
..
..
===New===
<html>
<title>A simple math calculator</title>
<body>
Insert two numbers in the next form and hit submit button <br>
<form action="calculation.php" method="post">
Firstnumber: <input name="num1" type="text" /><br>
Secondnumber: <input name="num2" type="text" />
<input type="submit" />
</form>
</body>
</html>
<html>
<head>
<title>Simple Math With User Input</tite>
</head>
<body>
<?php
$num1 = $_POST['num1'];
$num2 = $_POST['num2'];
$a = $num1 + $num2;
$b = $num1 - $num2;
echo "The sum of the two numbers is ". $a
echo "The difference of the two numbers is ". $b
?>
</body>
</html>

Revision as of 20:22, 11 December 2012