Solution:
<html>
<?php
$n=$_GET["n"];
$n1=$_GET["n1"];
$a=$_GET["a"];
?>
<form action="<?php echo $_SERVER["PHP_SELF"]?>" method="GET">
ENTER distance IN meter:<input type="number" name="n"><br>
ENTER distance IN kilometer:<input type="number" name="n1"><br>
<input type="radio" name="a" value="1">Convert to meters
<input type="radio" name="a" value="2">Convert to kilometers<br>
<input type="submit" value="Ok">
<br>
<?PHP
switch($a)
{
case 1:$c=round($n1*1000);
echo"Distance in meters is $c";
break;
case 2:$c=round($n/1000);
echo"Distance IN Kilometers is $c";
break;
}
?>
</form>
</html>
0 Comments