What is the purpose of the random button in the PHP code provided and what is the expected behavior when clicked?

The purpose of the random button in the PHP code is to generate a random number between 1 and 100 when clicked. The expected behavior when the button is clicked is to display this random number on the webpage.

<!DOCTYPE html>
<html>
<head>
    <title>Random Number Generator</title>
</head>
<body>
    <h1>Random Number Generator</h1>
    
    <form method="post">
        <input type="submit" name="generate" value="Generate Random Number">
    </form>

    <?php
    if(isset($_POST['generate'])){
        $random_number = rand(1, 100);
        echo "<p>Random Number: $random_number</p>";
    }
    ?>
</body>
</html>