How to redirect to another page using PHP

前端 未结 12 1381
粉色の甜心
粉色の甜心 2020-12-02 16:50

I am building a website which includes a login page. I need to redirect the user to their profile page once they\'ve logged in successfully, but I don\'t know how to do that

12条回答
  •  既然无缘
    2020-12-02 17:44

    Although not secure, (no offense or anything), just stick the header function after you set the session variable

     while($row = mysql_fetch_assoc($result))
        {
                $_SESSION["user"] = $username;
        }
    header('Location: /profile.php');
    

提交回复
热议问题