galvin Posted May 14, 2009 Share Posted May 14, 2009 I want to be able to sometimes redirect users to the CURRENT page, whatever page that may be, rather than actually redirect them to another page. I have this function below that works fine for truly redirecting, but how can I adjust this code to allow "redirecting" to the CURRENT page?... function redirect_to($location = NULL ) { if($location != NULL) { header("Location: {$location}"); exit; } } Link to comment https://forums.phpfreaks.com/topic/158061-solved-redirect-to-current-page/ Share on other sites More sharing options...
Cosizzle Posted May 14, 2009 Share Posted May 14, 2009 $_SERVER['PHP_SELF'] Should work Link to comment https://forums.phpfreaks.com/topic/158061-solved-redirect-to-current-page/#findComment-833764 Share on other sites More sharing options...
Ken2k7 Posted May 14, 2009 Share Posted May 14, 2009 Or $_SERVER['SCRIPT_URL'] Link to comment https://forums.phpfreaks.com/topic/158061-solved-redirect-to-current-page/#findComment-833765 Share on other sites More sharing options...
galvin Posted May 14, 2009 Author Share Posted May 14, 2009 Thanks!!!! Link to comment https://forums.phpfreaks.com/topic/158061-solved-redirect-to-current-page/#findComment-833767 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.