trying to create the front end to a script that will calculate the area and circumference of a circle.
(1)HTML form that will contain three input fields and a submit buttom
(2) will have only one text input field that input field is radius
(3)Create a calculation script with the following data:
Variables: Readius, Area, and Circumference
Constant: Pi = 3.1415926535
this is the script i have written so far
(HTML Form)
<html>
<head>
<title>
Calculation Form
</title>
</head>
<body>
<form method="post action="circumference.php">
<p>Radius:<input type="text" name="val1" size=10></p>
<p><input type="text" name="val2" size=10></p>
<p><input type="text" name="val3" size=10></p>
<p><input type="submit" name="submit" value="calculate"></p>
</form>
</body>
</html>
(PHP Calculation Script)
<?
if (($_POST[val1] == "") || ($_POST[val2] == "") || ($_POST[calc] =="")) {
// more code goes here
}
header("Location: http://127.0.0.1/findcirc.html"); exit;
if ($_POST[calc]== "add") (
$result = $_POST[val1] + $_POST[val2];
) else if ($_POST[calc] == "variables") {
$result= $_POST[val1] - $_POST[val2];
} else if ($_POST[calc]) == "radius") {
$result = $_POST[val1] * $_POST[val2];
} else if ($_POST[calc] == "cirumference") {
$result = $_POST[val1] / $_POST[val2];
}
?>
Thnk