Q. Write a program in PHP to find greater number from two numbers. 1
<?php
$a = 100;
$b = 20;
if($a > $b) {
echo "$a is greater than $b";
}
else {
echo "$b is greater than $a";
}
?>
Q. Write a program in PHP to Input two numbers and find greater. 1
<?php
$a=0;
$b=0;
if(isset($_GET['submit'])) {
$a=$_GET['a'];
$b=$_GET['b'];
if($a > $b) {
echo "$a is greater than $b";
}
else {
echo "$b is greater than $a";
}
}
?>
<html>
<body>
<form action="" method="get">
<p>Enter 1st Number: <input type="text" name='a' value="<?php echo $a; ?>"></p>
<p>Enter 2nd Number: <input type="text" name='b' value="<?php echo $b; ?>"></p>
<button type="submit" name="submit">Submit
</form>
</body>
</html>