Jump to content

Redirecting


Haraldur1234

Recommended Posts

header("Location: news.php");

 

This must be done before any output is ever sent (echo, print, etc).

 

I dont mean header, i mean it redirects you so your url is first lets say http://localhost/login.php, then i post and it goes to http://localhost/checkuser.php and then if its approved it goes to http://localhost/news.php!

Link to comment
https://forums.phpfreaks.com/topic/208567-redirecting/#findComment-1089706
Share on other sites

header("Location: news.php");

 

This must be done before any output is ever sent (echo, print, etc).

 

I dont mean header, i mean it redirects you so your url is first lets say http://localhost/login.php, then i post and it goes to http://localhost/checkuser.php and then if its approved it goes to http://localhost/news.php!

 

<?php
//Login Stuff
if($success){
    //redirect them to news.php
    header("Location: news.php");
} else{
    //bad username/password - redirect back to login form
    header("Location: login.php");
}

Link to comment
https://forums.phpfreaks.com/topic/208567-redirecting/#findComment-1089721
Share on other sites

header("Location: news.php");

 

This must be done before any output is ever sent (echo, print, etc).

 

I dont mean header, i mean it redirects you so your url is first lets say http://localhost/login.php, then i post and it goes to http://localhost/checkuser.php and then if its approved it goes to http://localhost/news.php!

 

<?php
//Login Stuff
if($success){
    //redirect them to news.php
    header("Location: news.php");
} else{
    //bad username/password - redirect back to login form
    header("Location: login.php");
}

 

Thnx

Link to comment
https://forums.phpfreaks.com/topic/208567-redirecting/#findComment-1089723
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.