jonsamwell Posted January 7, 2009 Share Posted January 7, 2009 Hi all, I am using the header() function to redirect users but i want to redirect them to a page and set a value in the url i.e. header("Location: ../index.php&action=register"); however the server obviously cannot find the page when it tries to look for 'index.php&action=register'. Is there a way to do this i.e. setting a value in the URL when redirecting? Thanks in advance, Jon Link to comment https://forums.phpfreaks.com/topic/139819-solved-redirect-to-indexphpvar1-problem/ Share on other sites More sharing options...
trq Posted January 7, 2009 Share Posted January 7, 2009 Use ? not & header("Location: http://yoursite.com/index.php?action=register"); ps: The location header should also be a complete uri according to http specs. Link to comment https://forums.phpfreaks.com/topic/139819-solved-redirect-to-indexphpvar1-problem/#findComment-731461 Share on other sites More sharing options...
jonsamwell Posted January 7, 2009 Author Share Posted January 7, 2009 i don't have a absolute URL yet is there a way to do it with a relative address? Regards Jon Link to comment https://forums.phpfreaks.com/topic/139819-solved-redirect-to-indexphpvar1-problem/#findComment-731467 Share on other sites More sharing options...
trq Posted January 7, 2009 Share Posted January 7, 2009 header("Location: {$_SERVER['SERVER_NAME']}/index.php?action=register"); Link to comment https://forums.phpfreaks.com/topic/139819-solved-redirect-to-indexphpvar1-problem/#findComment-731471 Share on other sites More sharing options...
jonsamwell Posted January 7, 2009 Author Share Posted January 7, 2009 brilliant thanks! Link to comment https://forums.phpfreaks.com/topic/139819-solved-redirect-to-indexphpvar1-problem/#findComment-731473 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.