我有一个包含一些信息的页面,我想使用 php 在另一个页面上调用其中的一些信息

时间:2021-05-17 15:33:48

标签: php

我有一个登录页面,我想如果用户写了正确的密码,但是对于每个有密码的用户,当他转到另一个页面时,他根据写的密码出现在他面前,Welcome Bishoy 或 Hani

>

HTML

<form action="INDEX.PHP" method="POST" class="two">
    <div>
        <button class="yeu"  id="submit" type="submit" name="submit">LOGIN</button>
        <input type="text" name="username" id="username" minlength="14" maxlength="14" required>
    </div>
    <div id="user" style="color: black; font-size: 20px; text-align: left;">
        <pre style="color: black; font-size: 20px; text-align: left; display: none;"></pre>
</form>

登录.PHP

<?php 
if(isset($_POST['submit'])){
    $username = $_POST['username'];
    if ($username === "01234567891012"){
        $username = "PISHOY";
        header('Location: no_error.php');
        exit;
    }
    elseif ($username === "01234567891013"){
        $username = "HANY";
        header('Location: no_error.php');
        exit;
    }
    elseif ($username === "01234567891014"){
        $username = "ALI";
        header('Location: no_error.php');
        exit;
    }
    elseif ($username === "01234567891015"){
        $username = "PISH";
        header('Location: no_error.php');
        exit;

    }
else{
header("location: error.php");
}
}
?>

PAGE2

<div id="true"><?php
         include 'index_p.php';
    echo "HELLO $username";?>

有什么问题

0 个答案:

没有答案