6. (A) Write a PHP code to find the greater of 2 numbers. Accept the no. from the user
<html> | ||
| <head> | ||
| <h1>Greater of Two Numbers</h1> | ||
| </head> | ||
| <body> | ||
| <form method="post"action="check.php"> | ||
| 1st number:<input type="text"name="n1"><br> | ||
| 2nd number:<input type="text"name="n2"><br> | ||
| <input type="submit" value="check"> | ||
| </form> | ||
| </body> | ||
| </html> | ||
| Check.php: | ||
| <?php | ||
| $n1=(int)$_POST['n1']; | ||
| $n2=(int)$_POST['n2']; | ||
| if($n1>$n2) | ||
| echo $n1."is greater than".$n2; | ||
| elseif($n2>$n1) | ||
| echo $n2."is greater than".$n1; | ||
| else | ||
| echo"Both the numbers are equal"; | ||
| ?> |
6. (A) Write a PHP code to find the greater of 2 numbers. Accept the no. from the user
Reviewed by admin
on
December 24, 2019
Rating:
No comments: