Baabu Posted February 29, 2008 Share Posted February 29, 2008 Is there any other way to redirect the page after showing some outputs on the page and then redirect? Quote Link to comment https://forums.phpfreaks.com/topic/93626-how-to-redirect/ Share on other sites More sharing options...
unsider Posted February 29, 2008 Share Posted February 29, 2008 Possibly a time redirect? How long will you let them view the page before redirecting, and what purpose does that serve? Quote Link to comment https://forums.phpfreaks.com/topic/93626-how-to-redirect/#findComment-479735 Share on other sites More sharing options...
Ads Posted February 29, 2008 Share Posted February 29, 2008 I Use Javascript print "<script>"; print " self.location='main.php';"; // Comment this line if you don't want to redirect print "</script>"; Quote Link to comment https://forums.phpfreaks.com/topic/93626-how-to-redirect/#findComment-479736 Share on other sites More sharing options...
hawkenterprises Posted February 29, 2008 Share Posted February 29, 2008 you can use javascript and do it <script type="text/javascript"> document.location = 'where to sparky'; </script> Quote Link to comment https://forums.phpfreaks.com/topic/93626-how-to-redirect/#findComment-479737 Share on other sites More sharing options...
Baabu Posted February 29, 2008 Author Share Posted February 29, 2008 thx it worked for me but how can i add a time limit that page should redirect after that time period? Quote Link to comment https://forums.phpfreaks.com/topic/93626-how-to-redirect/#findComment-479741 Share on other sites More sharing options...
unsider Posted February 29, 2008 Share Posted February 29, 2008 I would suggest PHP to conquer this job, considering dealing with time is rather easily, and because it is client-side you most likely won't have problems, as opposed to the possibilities with JS. But I'll keep my mouth shut now. Quote Link to comment https://forums.phpfreaks.com/topic/93626-how-to-redirect/#findComment-479742 Share on other sites More sharing options...
Lijoyx Posted February 29, 2008 Share Posted February 29, 2008 hai you can set a timer like this in javascript setTimeout(fname,3000) fname= function name to work 3000 means 3 seconds Quote Link to comment https://forums.phpfreaks.com/topic/93626-how-to-redirect/#findComment-479746 Share on other sites More sharing options...
moon 111 Posted February 29, 2008 Share Posted February 29, 2008 If you want it to wait before redirecting you can use this bit of javascript: <script> setTimeout("location='index.php'", 3000); // Execute the statement location='index.php' after 3000 miliseconds (3 seconds) </script> Quote Link to comment https://forums.phpfreaks.com/topic/93626-how-to-redirect/#findComment-479753 Share on other sites More sharing options...
timmy0320 Posted February 29, 2008 Share Posted February 29, 2008 Why use JS when you can use header? Just curious. header("Refresh: 5; URL=page.php"); Quote Link to comment https://forums.phpfreaks.com/topic/93626-how-to-redirect/#findComment-479851 Share on other sites More sharing options...
trq Posted February 29, 2008 Share Posted February 29, 2008 Why use JS when you can use header? Just curious. header("Refresh: 5; URL=page.php"); Because the header() function cannot be called after any output has been sent. Quote Link to comment https://forums.phpfreaks.com/topic/93626-how-to-redirect/#findComment-479852 Share on other sites More sharing options...
Baabu Posted February 29, 2008 Author Share Posted February 29, 2008 thx for the help mates Quote Link to comment https://forums.phpfreaks.com/topic/93626-how-to-redirect/#findComment-479866 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.