Slip 12 - A) Write a PHP program to convert temperature Fahrenheit to Celsius using sticky form.

 Solution:

<html>
<body>
<?php
$fahr=$_POST['fahrenheit']
<form action="<?php echo $_SERVER['PHP_SELF']?>"method="POST">
fahrenheit temperature:
<input type="text" name="fahrenheit" value=if(isset(=$_POST['fahrenheit'])){echo $fahr}?>>
<input type ="submit">
</form>
<?php
$Celsius=($fahr-32)*5/9;
printf("%f:%f,$fahr,$Celsius);
?>
</body>
</html>

Post a Comment

0 Comments