Php simple calculator


index.html

<html>
<title>A simple math calculator</title>
<body>
Insert two numbers in the next form and hit submit button <br>
<form action="TextFieldValue.php" method="post"> 
Firstnumber: <input name="num1" type="text" /><br>
Secondnumber: <input name="num2" type="text" /> 
<input type="submit" />
</form>
</body>
</html>

  
TestFieldValue.php

<html>
<head>
<title>Simple Math With User Input</title>
</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>




I Am Not The Owner Of These Code .I Merely Have Copied Them From Various Sources. The Only Thing I Did Is That I Am Going To Present Them In More Easy Way To Understand.

Comments

Popular posts from this blog

LED Blinking using 8051 Microcontroller and Keil C – AT89C51

Android Camera Example 2

Java Script to make text change text color