First of all, I am not en expert at programming, so please explain things a bit if you can so I can understand them better. I am trying to make a calculator that will have some fields the user can fill out, and will display the last output. Basically this:
Variable boxes "Go" button Results display here after Go is pressed.
And the user can change the boxes and click go again to refresh with the new results.
I do not want to use Java for this if at all possible. Please help me with an HTML/PHP solution.
I have this page nammed "isset.php"
<?php
session_start();
error_reporting(E_ALL);
ini_set('display_errors', '1');?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<body>
<?php
if(isset($_POST['submit']))
{
$a = $_POST['a'];
$b = $_POST['b'];
$sf = $a-(2*$b);
echo "<br><br>Safety Factor is ";
echo $sf;
}
else {
echo "Your results will display here after you use the calculator.";
}
?>
<br>Calculator
<form name="submit" method="post" action="isset.php">
<table width="450px">
<td valign="center">
<label for="a">a</label></td>
<td valign="center">
<input type="text" name="a" value="45"></td></tr>
<td valign="center">
<label for="b">b</label></td>
<td valign="center">
<input type="text" name="b" value="16"></td></tr>
<tr><td colspan="2" style="text-align:center">
<input type="submit" value="Calculate!">
</td></tr></table>
</form>
</body>
</html>