Greatest among any two numbers using PHP

<title>Find the greatest number</title>
<form method="post" >
<label for="number1">Enter the first number:</label>
<input type="number" id="number1" name="number1"><br><br>
<label for="number2">Enter the second number:</label>
<input type="number" id="number2" name="number2"><br><br>
<input type="submit" name="submit" value="Find the greatest number">

if (isset($_POST['submit'])) {
$num1 = $_POST['number1'];
$num2 = $_POST['number2'];

if ($num1 > $num2) {
echo "The greatest number is " . $num1;
} else {
echo "The greatest number is " . $num2;

Leave a Reply

Your email address will not be published. Required fields are marked *