trink Posted September 6, 2007 Share Posted September 6, 2007 I've been searching all over for this and for some reason, I can't find anything viable. I found http_redirect on http://us3.php.net/manual/en/function.http-redirect.php, and I used it on my page, and it returned this. Fatal error: Call to undefined function: http_redirect(). What would I do to redirect the user to a page AND keep the variables that were set? Quote Link to comment https://forums.phpfreaks.com/topic/68257-solved-redirect-to-a-url/ Share on other sites More sharing options...
LiamProductions Posted September 6, 2007 Share Posted September 6, 2007 <?php header("Location: http://ImAstupidIdoit.com"; ?> I believe that would work. Quote Link to comment https://forums.phpfreaks.com/topic/68257-solved-redirect-to-a-url/#findComment-343147 Share on other sites More sharing options...
trink Posted September 6, 2007 Author Share Posted September 6, 2007 It redirected the page, but it didn't keep all the variables. Is there any way to keep all the variables stored when it redirects? Quote Link to comment https://forums.phpfreaks.com/topic/68257-solved-redirect-to-a-url/#findComment-343159 Share on other sites More sharing options...
LiamProductions Posted September 6, 2007 Share Posted September 6, 2007 If you Post them to the next page i'm sure its possible or if the page is blank you could include the page Quote Link to comment https://forums.phpfreaks.com/topic/68257-solved-redirect-to-a-url/#findComment-343160 Share on other sites More sharing options...
GingerRobot Posted September 6, 2007 Share Posted September 6, 2007 The easiest way would be pass all the parameters you need along with the url: <?php header("location:http://www.yoursite.com/file.php?foo=bar&var=something"); ?> You can then retrieve them using from the $_GET array. Quote Link to comment https://forums.phpfreaks.com/topic/68257-solved-redirect-to-a-url/#findComment-343164 Share on other sites More sharing options...
trink Posted September 6, 2007 Author Share Posted September 6, 2007 If you Post them to the next page i'm sure its possible or if the page is blank you could include the page How would I post them to the next page? $_CONFIG is an array, and I'd like to post it so that I can get it on the next page with $_POST How would I go about doing that? I don't want to use hidden inputs, and I don't want to do it via the URL. Any tips? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/68257-solved-redirect-to-a-url/#findComment-343334 Share on other sites More sharing options...
BlueSkyIS Posted September 6, 2007 Share Posted September 6, 2007 "I don't want to use hidden inputs, and I don't want to do it via the URL." Your only remaining alternative is sessions. Quote Link to comment https://forums.phpfreaks.com/topic/68257-solved-redirect-to-a-url/#findComment-343339 Share on other sites More sharing options...
trink Posted September 6, 2007 Author Share Posted September 6, 2007 Sounds good. How would I do that? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/68257-solved-redirect-to-a-url/#findComment-343344 Share on other sites More sharing options...
BlueSkyIS Posted September 6, 2007 Share Posted September 6, 2007 http://us3.php.net/manual/en/ref.session.php long story short: page 1: session_start(); $_SESSION['var1'] = "hello world"; page 2: session_start(); echo $_SESSION['var1']; Quote Link to comment https://forums.phpfreaks.com/topic/68257-solved-redirect-to-a-url/#findComment-343345 Share on other sites More sharing options...
trink Posted September 7, 2007 Author Share Posted September 7, 2007 I got all that, and so I thought the problem was something a bit different, but it turns out it was the host's problem with the ftp. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/68257-solved-redirect-to-a-url/#findComment-343381 Share on other sites More sharing options...
rhyspaterson Posted September 7, 2007 Share Posted September 7, 2007 Pretty sure this should be a sticky. Quote Link to comment https://forums.phpfreaks.com/topic/68257-solved-redirect-to-a-url/#findComment-343424 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.