0

can any one help me with this script I am just gettin started with PHP

I am trying to create an calculation script that would
calculate the

Constant: PI = 3.1415926535
Radius, area, and circumference of a circle .

This is what I have dont so far but just cant seem to get it working

can some one tell me what i am doing wrong

<html>
<head>
<title>
Calculation Form
</title>
</head>
<body>

<form method="post" action="circumference.php">

<p>Rad:<input type="text" name="radius=" size=10></p>


<p><input type="submit" name="submit" value="calculate"></p>
</form>

</body>
</html>


PHP Script

<? php

if (!isset($_POST)) {
echo '<form action="' . $_SERVER . '" . method="post">' .
'<input type="text" name="radius" />' .
'<input type="submit" name="submit" value="Calculate" />' .
'</form>';
} else {
$circumference = M_PI * $_POST * 2;
$area = M_PI * pow($_POST, 2);
echo 'Circumference = ' . $circumference . ' units<br />';
echo 'Area = ' . $area . ' sq. units<br />';
}

?>
<html>
<head>
<title></title>
</head>

<body>
<p> This result of the is : <? echo "$result" ; ?></p>
</body>
</html>

Thanks

3
Contributors
2
Replies
3
Views
11 Years
Discussion Span
Last Post by DanceInstructor
0
<p> This result of the is : <? echo "$result" ; ?></p>

Where did you define $result? And it is also better to use <?php than <?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.