Well, I attempted to handle this assignment on my own, but it's gotten to the point that I need assistance. I am making a Converter. From Fahrenheit to Celsius, and I can't seem to get my current code to work:
Code:
<html>
<head>
<title>Temperature Conversion</title>
</head>
<body>
<h2>Temperature Conversion</h2>
<form method="post"
action="<?php echo $_SERVER['PHP_SELF']; ?>">
Fahrenheit:
<input type = "text" name = "fTemp">
<br>
Celsius:
<input type = "text" name = "cTemp">
<br>
<input type = "submit">
</form>
<?
{
if(isset($_POST['fTemp']))
$cTemp = (float)(($fTemp - 32) / 1.8 );
}
{
if(isset($_POST['cTemp']))
$fTemp = (float)(1.8 * $cTemp) + 32;
}
?>
</body>
</html>
It doesn't come up with any errors, and i've tried about 100 forms of this code. I just can't get the information processed and output into the same box.
|