943,923 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 1258
  • PHP RSS
Mar 30th, 2006
0

PhP scripting help

Expand Post »
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['submit'])) {
echo '<form action="' . $_SERVER['PHP_SELF'] . '" . method="post">' .
'<input type="text" name="radius" />' .
'<input type="submit" name="submit" value="Calculate" />' .
'</form>';
} else {
$circumference = M_PI * $_POST['radius'] * 2;
$area = M_PI * pow($_POST['radius'], 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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
benzspider is offline Offline
3 posts
since May 2005
Mar 30th, 2006
0

Re: PhP scripting help

What error message(s) are you getting?
Reputation Points: 10
Solved Threads: 1
Junior Poster in Training
UberAAZ is offline Offline
73 posts
since Oct 2005
Mar 31st, 2006
0

Re: PhP scripting help

[PHP]<p> This result of the is : <? echo "$result" ; ?></p>[/PHP]

Where did you define $result? And it is also better to use <?php than <?
Reputation Points: 17
Solved Threads: 14
Posting Whiz
DanceInstructor is offline Offline
355 posts
since Feb 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: PHP-MySQL retrieval or getting data
Next Thread in PHP Forum Timeline: Desperate Again Please HELP PHP





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC