<?php ?>
<form name="tempConvert" method="POST" action="<?php echo $_SERVER["PHP_SELF"]; ?>">
<table>
<tr>
<td>Enter value to convert</td>
<td><input type="text" name="valueConvert" id="valueConvert" size="15"></td>
</tr>
<tr>
<td>Convert to:</td>
<td><select name="convertType" id="convertType" size="1">
<option disabled> Select a measurement type</option>
<option value="celsius">Celsius</option>
<option value="fahrenheit">Fahrenheit</option>
</select>
</td>
</tr>
<tr>
<td><input type="submit" name="btnConvert" id="btnConvert" value="Convert"></td>
<td><input type="reset" name="btnReset" id="btnReset" value="Reset"></td>
</tr>
</form>
<?php
function tempConvert($value, $type){
if($type== "fahrenheit"){
return (((9/5)*$value) +(32));
}
elseif ($type== "celsius"){
return (($valueConvert - 32) * (9/5));
}
}
if (isset($_POST['btnConvert'])) {
$valueConvert = $_POST['valueConvert'];
$convertType = $_POST['convertType'];
echo "The initial temperature was $valueConvert. The new temperature is tempConvert($valueConvert, $convertType).";
}
?>
- Output for 5.2.3 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.7 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
- <form name="tempConvert" method="POST" action="/in/PPZNL">
<table>
<tr>
<td>Enter value to convert</td>
<td><input type="text" name="valueConvert" id="valueConvert" size="15"></td>
</tr>
<tr>
<td>Convert to:</td>
<td><select name="convertType" id="convertType" size="1">
<option disabled> Select a measurement type</option>
<option value="celsius">Celsius</option>
<option value="fahrenheit">Fahrenheit</option>
</select>
</td>
</tr>
<tr>
<td><input type="submit" name="btnConvert" id="btnConvert" value="Convert"></td>
<td><input type="reset" name="btnReset" id="btnReset" value="Reset"></td>
</tr>
</form>
- Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.2
- <form name="tempConvert" method="POST" action="">
<table>
<tr>
<td>Enter value to convert</td>
<td><input type="text" name="valueConvert" id="valueConvert" size="15"></td>
</tr>
<tr>
<td>Convert to:</td>
<td><select name="convertType" id="convertType" size="1">
<option disabled> Select a measurement type</option>
<option value="celsius">Celsius</option>
<option value="fahrenheit">Fahrenheit</option>
</select>
</td>
</tr>
<tr>
<td><input type="submit" name="btnConvert" id="btnConvert" value="Convert"></td>
<td><input type="reset" name="btnReset" id="btnReset" value="Reset"></td>
</tr>
</form>
preferences:
216.21 ms | 404 KiB | 328 Q