943,712 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 19976
  • PHP RSS
Sep 1st, 2005
0

Wait some time and after that redirect another Location

Expand Post »
when we use header for redirecting, it will be redirect immediatelly. so how can page is wait after the redirct another location.
I am request to all of u, if you have any suggession or code, please help me.

Rgds.
Dheeraj
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Dheeraj Kumar is offline Offline
6 posts
since Jul 2005
Sep 1st, 2005
0

Re: Wait some time and after that redirect another Location

You can use sleep function before header('Location:http://xyz.com'). If just microsecond, then use usleep.
Reputation Points: 10
Solved Threads: 7
Posting Whiz in Training
zippee is offline Offline
294 posts
since Jan 2005
Sep 2nd, 2005
0

Re: Wait some time and after that redirect another Location

Thank you zippee


Rgds.
dheeraj
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Dheeraj Kumar is offline Offline
6 posts
since Jul 2005
Sep 2nd, 2005
0

Re: Wait some time and after that redirect another Location

You may also want to have a holding page which has a meta refresh on it. This is a strategy used on forums and a great many sites.
Reputation Points: 10
Solved Threads: 1
Junior Poster
sarahk is offline Offline
138 posts
since Apr 2005
Sep 2nd, 2005
0

Re: Wait some time and after that redirect another Location

Quote ...
Hi,

I am using this code to redirecting another page. But still, it is not working.
---------------------------------------------
<?php
if(!$sql){
echo 'There has been an Error for Submitting your request. Please Contact the Web Master.';
}else{
echo "Hello <u><b>".$name."</b></u>";
echo '<br/><hr>Thank you';
echo '<br/><br/>Your Request is under process. Our Representative will get in touch with you.';
sleep(5);
echo '<script><!-- window.location= "http://www.widecomindia.com/home.html" //--></script>';
// header("Location: http://www.widecomindia.com/home.html");
}

--------------------------------------------

if u have any example or suggession, please given reply.

Rgds.

Dheeraj
Hi Dheeraj - it's bad form to PM when you've already got a thread going...

the problem is that you're using window.location not meta refresh. Search google. There are plenty of sites showing how to do it.
Reputation Points: 10
Solved Threads: 1
Junior Poster
sarahk is offline Offline
138 posts
since Apr 2005
Sep 28th, 2005
0

Re: Wait some time and after that redirect another Location

Quote ...
<?php
if(!$sql){
echo 'There has been an Error for Submitting your request. Please Contact the Web Master.';
}else{
echo "Hello <u><b>".$name."</b></u>";
echo '<br/><hr>Thank you';
echo '<br/><br/>Your Request is under process. Our Representative will get in touch with you.';
sleep(5);
echo '<script><!-- window.location= "http://www.widecomindia.com/home.html" //--></script>';
// header("Location: http://www.widecomindia.com/home.html");
}
You cannot use php to send a http redirect header after you have sent output to the browser.
This is limited by the http protocol.

You will have to use javascript, or the meta refresh method.

JS:

<script>
<!--
timeout = '5000'; // milliseconds/1000th of a sec
window.onload = setTimeout(myRedirect, timeout); // ensure we load the whole page

function myRedirect() {

window.location = "http://www.widecomindia.com/home.html";
}
//-->
</script>
Moderator
Reputation Points: 457
Solved Threads: 101
Nearly a Posting Virtuoso
digital-ether is offline Offline
1,250 posts
since Sep 2005
Sep 29th, 2005
0

Re: Wait some time and after that redirect another Location

[PHP]header("Refresh: 3; http://www.yourdomain.com"); [/PHP]

Try replacing '3' with your choice. Hope it helps.
PoA
Reputation Points: 19
Solved Threads: 9
Posting Whiz in Training
PoA is offline Offline
234 posts
since Jul 2004
Jul 17th, 2010
0
Re: Wait some time and after that redirect another Location
echo '<meta http-equiv="refresh" content="3; index.php" />';
Reputation Points: 9
Solved Threads: 1
Newbie Poster
phpl0v3r is offline Offline
10 posts
since Jul 2010
Sep 28th, 2010
0
Re: Wait some time and after that redirect another Location
Thanks i also need this.
Reputation Points: 16
Solved Threads: 6
Junior Poster in Training
jogesh_p is offline Offline
68 posts
since Sep 2010

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Save a page in php
Next Thread in PHP Forum Timeline: Problem with php coding





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC