PhP scripting help

Reply

Join Date: May 2005
Posts: 3
Reputation: benzspider is an unknown quantity at this point 
Solved Threads: 0
benzspider benzspider is offline Offline
Newbie Poster

PhP scripting help

 
0
  #1
Mar 30th, 2006
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
Reply With Quote Quick reply to this message  
Join Date: Oct 2005
Posts: 73
Reputation: UberAAZ is an unknown quantity at this point 
Solved Threads: 1
UberAAZ's Avatar
UberAAZ UberAAZ is offline Offline
Junior Poster in Training

Re: PhP scripting help

 
0
  #2
Mar 30th, 2006
What error message(s) are you getting?
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 355
Reputation: DanceInstructor is an unknown quantity at this point 
Solved Threads: 14
DanceInstructor's Avatar
DanceInstructor DanceInstructor is offline Offline
Posting Whiz

Re: PhP scripting help

 
0
  #3
Mar 31st, 2006
[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 <?
Clear Mind Hosting and Web Design

If I've helped you please consider adding to my reputation.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum


Views: 1175 | Replies: 2
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC