Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/228.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 重定向到html中的其他页面_Php_Html_Forms - Fatal编程技术网

Php 重定向到html中的其他页面

Php 重定向到html中的其他页面,php,html,forms,Php,Html,Forms,我正在尝试使用meta-req方法将数据提交到另一个html页面后重定向html表单页面。他们的任何其他方法都可以重定向页面,因为问题是它显示了php命令的一个中间页面,这是我不想要的 我的html代码是 <form method="POST" action="yoga_signup.php"> <div class="row" style=" margin-top:4rem; margin-left:24rem;">

我正在尝试使用meta-req方法将数据提交到另一个html页面后重定向html表单页面。他们的任何其他方法都可以重定向页面,因为问题是它显示了php命令的一个中间页面,这是我不想要的 我的html代码是

    <form method="POST" action="yoga_signup.php">
            <div class="row" style="    margin-top:4rem; margin-left:24rem;">
                <div class="col-md-6 mx-auto p-0">
                    <div class="card">
                        <div class="login-box">
                            <div class="login-snip"> <input id="tab-1" type="radio" name="tab" class="sign-in" checked><label for="tab-1" class="tab">Login</label> <input id="tab-2" type="radio" name="tab" class="sign-up"><label for="tab-2" class="tab">Sign Up</label>
                                <div class="login-space">
                                    <div class="login">
                                        <input type="hidden" name="for_page" value="login">
                                        <div class="group"> <label for="user" class="label">Username</label> <input id="user" type="text" class="input" name="username" placeholder="Enter your username" required> </div>
                                        <div class="group"> <label for="pass" class="label">Password</label> <input id="pass" type="password" name="password_1" class="input" data-type="password" placeholder="Enter your password" required> </div>
                                        <div class="group"> <input id="check" type="checkbox" class="check" checked> <label for="check"><span class="icon"></span> Keep me Signed in</label> </div>
                                        <div class="group"> <input type="submit" class="button" value="Sign In"> </div>
                                        <div class="hr"></div>
我的php代码也是一样的

<?php

session_start();
$conn= new mysqli("localhost","root","","yoga");

if($_SERVER["REQUEST_METHOD"]=="POST"){
    $TypeOfRequest=$_POST['for_page'];
    if($TypeOfRequest=="signup"){
        $user=$_POST['username'];
        $pass_1=$_POST['password_1'];
        $pass_2=$_POST['password_2'];
        $mail=$_POST['email'];

    if($pass_1===$pass_2){
        $val=" INSERT INTO yoga_login(username,password_1,password_2,email) VALUES('$user','$pass_1','$pass_2','$mail')";
        if($conn->query($val)===TRUE){
            echo "redirecting to login page.<meta http-equiv='refresh' content='1;login.html'>";
        }else{

            echo "registration unsucessfull";

        }


        }
    if($pass_1!==$pass_2){
        echo "please enter the same password";
    }
    }
    mysqli_close($conn);
}
他们的任何其他方法都不会像这样显示中间页面吗

只需替换:

echo "redirecting to login page.<meta http-equiv='refresh' content='1;login.html'>";

Location:login.htmlcan u plz修改了它的编写格式,因为我发现它没有什么困难,因为我只想在提交表单后重定向,用标题'Location:login.html'替换元标记;thnx它工作正常
header('Location: login.html');
exit;  // this is normally a good idea