开发者

How Can i use includ in php without excute the first page code

开发者 https://www.devze.com 2022-12-07 18:45 出处:网络
i try to get a variable from header page to a game page.. but when i do it with include \'header.php" he excute the header code in game.php ( header("refresh"))

i try to get a variable from header page to a game page.. but when i do it with include 'header.php" he excute the header code in game.php ( header("refresh")) i wanna to excute the refresh one time in first page only

header.php code :

<?php  
$memory = "ahmed";
echo "Remember This Word : " . $memory;
header("Refresh: 5; url= game.php");
// exit;
?>

game.php code :

<?php
// ob_start();
// include "header.php";
// ob_end_clean();
if ($_SERVER["REQUEST_METHOD"] =开发者_Python百科= "POST") {
       if($_POST['solution'] == "ahmed") {
          $_SESSION['username'] = $_POST['solution'];
        } else {
            echo "Try again";
        }
    }
        if(isset($_SESSION['username'])) {
            echo "Well Done <br>";
            echo '<a href="game.php"> Play again</a>';
        } else { 

?>  
<form action="" method="POST">
    <input type="text" name="solution" id="">
    <input type="submit" value="check">
</form>
<?php } ?>
0

精彩评论

暂无评论...
验证码 换一张
取 消