bobleny Posted June 21, 2007 Share Posted June 21, 2007 This is my situation: echo "text"; header("location:http://www.blah.com"); That doesn't work. Is there a different way of doing this, a way to redirect the page using PHP after text has been entered into the browser? Link to comment https://forums.phpfreaks.com/topic/56561-solved-how-can-i-use-php-to-redirect-to-a-different-page/ Share on other sites More sharing options...
trq Posted June 21, 2007 Share Posted June 21, 2007 Is there a different way of doing this, a way to redirect the page using PHP after text has been entered into the browser? Why would you need to output anything if all your going to do is redirect to another page? Makes no sense. Alot of people get there logic wrong here. Link to comment https://forums.phpfreaks.com/topic/56561-solved-how-can-i-use-php-to-redirect-to-a-different-page/#findComment-279365 Share on other sites More sharing options...
bobleny Posted June 21, 2007 Author Share Posted June 21, 2007 No, I'm just doing something very different.... So, is there another way of doing it, or not? Link to comment https://forums.phpfreaks.com/topic/56561-solved-how-can-i-use-php-to-redirect-to-a-different-page/#findComment-279377 Share on other sites More sharing options...
Zepo. Posted June 21, 2007 Share Posted June 21, 2007 echo "text <META HTTP-EQUIV=REFRESH CONTENT="2;URL=http://www.mynewurl.com">"; It's not php, but it will work. Link to comment https://forums.phpfreaks.com/topic/56561-solved-how-can-i-use-php-to-redirect-to-a-different-page/#findComment-279383 Share on other sites More sharing options...
bobleny Posted June 21, 2007 Author Share Posted June 21, 2007 echo "text <META HTTP-EQUIV=REFRESH CONTENT="2;URL=http://www.mynewurl.com">"; It's not php, but it will work. Thats what I have been using, but no matter how you do it, there is still a delay. The line has to be echoed, php has to stop, then, in your example, the user has to wait 2 seconds and thats only if their browser supports that tag... Is there a way to do what I want to do in php? Link to comment https://forums.phpfreaks.com/topic/56561-solved-how-can-i-use-php-to-redirect-to-a-different-page/#findComment-279482 Share on other sites More sharing options...
Zepo. Posted June 21, 2007 Share Posted June 21, 2007 You would proboly have to user javascript. Link to comment https://forums.phpfreaks.com/topic/56561-solved-how-can-i-use-php-to-redirect-to-a-different-page/#findComment-279483 Share on other sites More sharing options...
pikemsu28 Posted June 21, 2007 Share Posted June 21, 2007 i don't know if it's relevent or not but i was browsing php.net and found something about Output Control Functions that sounds like could help http://www.php.net/manual/en/ref.outcontrol.php i have no idea if this helps but just thought i'd throw it out there. Link to comment https://forums.phpfreaks.com/topic/56561-solved-how-can-i-use-php-to-redirect-to-a-different-page/#findComment-279490 Share on other sites More sharing options...
redarrow Posted June 21, 2007 Share Posted June 21, 2007 silly code but works good luck. fully tested. <?php ob_start(); $message="hi there i am redarrow<br>Your going to google in 2 secs"; echo $message; if($message){ header('refresh: 2; url=http://www.google.com'); } ?> Link to comment https://forums.phpfreaks.com/topic/56561-solved-how-can-i-use-php-to-redirect-to-a-different-page/#findComment-279491 Share on other sites More sharing options...
TripleDES Posted June 21, 2007 Share Posted June 21, 2007 Thanks for this. I used it to create a dynamic dropdown that redirects when a selection is made. <?php print "<font face=verdana size=2><br /><br />"; print "Redirect Me<br />"; $result = scandir("."); echo "<form enctype=multipart/form-data name=pick method=get action=$val>"; echo "<select onChange=javascript:document.pick.submit() name='goscript'>"; foreach($result as $val) { $val = trim($val); echo "<option value='$val'>$val</option>\n"; } if (isset($_GET['goscript'])) { header('Location: http://www.example.com/' . $_GET['goscript']); } echo "</select></form>"; print "</font>"; print $_GET['goscript']; ?> Link to comment https://forums.phpfreaks.com/topic/56561-solved-how-can-i-use-php-to-redirect-to-a-different-page/#findComment-279531 Share on other sites More sharing options...
trecool999 Posted June 21, 2007 Share Posted June 21, 2007 header('Refresh: 0; URL=http://www.google.co.uk'); Link to comment https://forums.phpfreaks.com/topic/56561-solved-how-can-i-use-php-to-redirect-to-a-different-page/#findComment-279535 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.