如何使用一行代码执行PHP重定向

如何使用一行代码执行PHP重定向,php,database,redirect,Php,Database,Redirect,嗨,我正在尝试做一个if语句,如果用户名和密码等于我数据库中的某个内容,那么它将转到一个页面,否则它将转到另一个页面。我遇到的问题是,如果没有href链接,我不知道如何将用户重定向到另一个页面。我找不到任何与此相关的东西,也找不到任何我可以去工作的东西 这是我的表格 <form action="" method="POST" class="mbr-form form-with-styler" data-form-title=&qu

嗨,我正在尝试做一个if语句,如果用户名和密码等于我数据库中的某个内容,那么它将转到一个页面,否则它将转到另一个页面。我遇到的问题是,如果没有href链接,我不知道如何将用户重定向到另一个页面。我找不到任何与此相关的东西,也找不到任何我可以去工作的东西

这是我的表格

<form action="" method="POST" class="mbr-form form-with-styler" data-form-title="Mobirise Form"><input type="hidden" name="email" data-form-email="true" value="ebXrsCFkyEilOcwLVabTInb5bd9jF9L29ky83zR0+60VHf98DYd4rDL//d/Y3Ug73DE8L4nKvcAhQVdTN7aTTusZnU8vqZzg6UDpw3DDpXZvzblZJJXTRV01xBPiEitp">
                    <div class="row">
                        <div hidden="hidden" data-form-alert="" class="alert alert-success col-12">Thanks for filling out the form!</div>
                        <div hidden="hidden" data-form-alert-danger="" class="alert alert-danger col-12">
                        </div>
                    </div>
                    <div class="dragArea row">
                        <div class="col-md-4  form-group" data-for="username">
                            <label for="username-form1-2" class="form-control-label mbr-fonts-style display-7">Username</label>
                            <input type="text" name="username" data-form-field="username" required="required" class="form-control display-7" id="username-form1-2" placeholder="Joe blog">
                        </div>
                        <div class="col-md-4  form-group" data-for="password">
                            <label for="password-form1-2" class="form-control-label mbr-fonts-style display-7">Password</label>
                            <input type="password" name="password" data-form-field="password" required="required" class="form-control display-7" id="password-form1-2" placeholder="qwerty">
                        </div>
                        <div data-for="organisation" class="col-md-4  form-group">
                            <label for="organisation-form1-2" class="form-control-label mbr-fonts-style display-7">Organisation</label>
                            <input type="tel" name="organisation" data-form-field="organisation" class="form-control display-7" id="organisation-form1-2">
                        </div>
                       
                        <div class="col-md-12 input-group-btn align-center">
                            <button type="submit" class="btn btn-primary btn-form display-4">Log in</button>
                        </div>
                        
                    </div>
                </form>
我一直收到这个错误消息
警告:无法修改标题信息-标题已由(输出从C:\wamp64\www\11PHP\2login.php:1开始)在C:\wamp64\www\11PHP\2login.php第13行发送,如果可以使用函数,请尝试此操作以避免重复

function Redirect_to($New_Location){
  header("Location:".$New_Location);
  exit;
}
调用函数:会话后,将_重定向到(“index.php”)

if($count > 0){
            $_SESSION['username'] = $username;
            header("Location: localhost/2after login.php");
        }else{
            echo 'Failed';
function Redirect_to($New_Location){
  header("Location:".$New_Location);
  exit;
}