访问从Heredoc内部设置PHP变量的HTML按钮

时间:2019-05-03 06:43:22

标签: php html heredoc

我有一些HTML代码:

</div>

<div class = "container">
    <form class = "form-signin" role = "form" 
        action = "<?php echo htmlspecialchars({$_SERVER['PHP_SELF']});
        ?>" method = "post">
        <h4 class = "form-signin-heading"><?php echo $msg; ?></h4>
        <input type = "text" class = "form-control"
           name = "username" placeholder = "username"
           required autofocus></br>
        <input type = "password" class = "form-control"
           name = "password" placeholder = "password" required><br><br>
        <button type = "submit"
           name = "login">Login</button><br>
        <button type = "submit"
           name = "Register">Register</button><br>
    </form>

    Click here to <a href = "logout.php" tite = "Logout">logout.

</div>

这是通过以下方式放在Heredoc之间的:

$html1 = <<<HTML
    .... html code ....
HTML;

echo $html1;

文档以php标签<?php ... ?>开始和结束。现在,我检查是否单击了注册按钮:

if(isset($_POST['Register'])) {
    echo 'Registering Happening';
}

但是绝对没有回声发生,我也不知道为什么。

0 个答案:

没有答案