Hello fellow coders I am having an issue coding a php calculator. My objective is to make it so that text changes depending on the operation chosen, and the answer is in the text box. if you dont input an answer, it will give you the right answer. here is how the website is supposed to act:http://usefullittlethings.com/static/index_done.php
here is my code:
<!DOCTYPE html>
<html>
<head>
<title>Online Math Calculator</title>
</head>
<body>
<h1>Thank you for trying out the online math calculator.</h1>
<h2>Enter two numbers to add, subtract, multiply, or divide.</h2>
<h3>If you enter the result, I will tell you if what you entered is right.</h3>
If you don't enter both numbers for a formula, I will ignore it.<br /><br />
<?php
$status= 'Waiting for input.<br>';
echo $status;
?>
<?php
function Calc(){
if (isset($a1)&&!isset($a2){
if (!empty($a1)&&!empty($a2)
$a3=$a1+$a2;
echo $status.'two numbers added.'
}
}
?>
<form action="index.php" method="post">
<strong>Addition:</strong><br />
<input type="text" name="a1" value="" />
plus
<input type="text" name="a2" value="" />
equals
<input type="text" name="a3" value="" />
<br /><br />
<strong>Subtraction:</strong><br />
<input type="text" name="s1" value="" />
minus
<input type="text" name="s2" value="" />
equals
<input type="text" name="s3" value="" />
<br /><br />
<strong>Multiplication:</strong><br />
<input type="text" name="m1" value="" />
times
<input type="text" name="m2" value="" />
equals
<input type="text" name="m3" value="" />
<br /><br />
<strong>Division:</strong><br />
<input type="text" name="d1" value="" />
divided by
<input type="text" name="d2" value="" />
equals
<input type="text" name="d3" value="" />
<br /><br />
<input type="submit" value="Calculate!" />
</form>
</body>
</html>
Thanks. Any help is appreciated!!!!!!!!!!!!!!!!!