MDanz Posted April 15, 2010 Share Posted April 15, 2010 i'm trying this on my login script but it's not working. $return = $_SESSION['url']; header( 'Location: $return' ) ; Link to comment https://forums.phpfreaks.com/topic/198605-php-redirect-page/ Share on other sites More sharing options...
dreamwest Posted April 15, 2010 Share Posted April 15, 2010 Look fine. Make sure you have session_start(); above the script and $_SESSION['url']; has a value Another way is to get the page url and redirect to the users previous page login.php?next=<?php echo $_SERVER["REQUEST_URI"]; ?> Link to comment https://forums.phpfreaks.com/topic/198605-php-redirect-page/#findComment-1042182 Share on other sites More sharing options...
MDanz Posted April 15, 2010 Author Share Posted April 15, 2010 it shows this in the browser. "http://www.example.com/$return" so i echoed $return and there is a value, it's correct. So something must be wrong with the header( 'Location: $return' ) ; Link to comment https://forums.phpfreaks.com/topic/198605-php-redirect-page/#findComment-1042185 Share on other sites More sharing options...
Pikachu2000 Posted April 15, 2010 Share Posted April 15, 2010 header( 'Location: ' . $return ); Link to comment https://forums.phpfreaks.com/topic/198605-php-redirect-page/#findComment-1042191 Share on other sites More sharing options...
Ken2k7 Posted April 15, 2010 Share Posted April 15, 2010 Yeah, something is wrong. Variable interpolation doesn't work with single quotes. Pikachu2000 provided the solution. Link to comment https://forums.phpfreaks.com/topic/198605-php-redirect-page/#findComment-1042193 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.