How can I make the tryguess.php appear on the trynumber.php?

<?php

session_start();

 

$_SESSION["correct_answer"] = rand(1,100);

$_SESSION["guess"] = 0;

?>  

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Document</title>

</head>

<body>

    <h1>Welcome to the Great Number Game!</h1>

    <h2>I am thinking of a number between 1 and 100</h2>

    <h2>Take a guess!</h2>

    <form method="post" action="tryguess.php">

        <input type="text" id="guess" name="guess">

        <input type="submit" value="submit">

        <!-- <a href="trynumber.php"><input type="submit" value="reset"></a> -->

    </form>

</body>

</html>

tryguess.php

<?php

session_start();

// header('Location: trynumber.php');

if (isset($_POST['guess'])) {

    if ($_POST['guess'] == $_SESSION['correct_answer']) {

        echo "correct!";

    }

    if ($_POST['guess'] < $_SESSION['correct_answer']) {

        echo "too low";

    }

    if ($_POST['guess'] > $_SESSION['correct_answer']) {

        echo "too high";

    }

}

?>
Sponsor our Newsletter | Privacy Policy | Terms of Service