Jump to content

Timedelay between 2 echo's


Vink
 Share

Recommended Posts

Hi,I am surching for a way to let the script wait for 3 seconds before moving onto the next echo...i have surched and tried many things but nothing workes..This is the script... between the 2 if($send) I want a execute-delay of 3 seconds...

$sent=mail(trim($to), $subject, $mess, $mailheaders);if($sent){echo"<img src=\"postecard.gif\">;}if($sent){echo"<img src=\"post.gif\">;}else{echo"<h5>the postcard is send.</h5>";}

Das someone knows if this is that posseble??regardsParis

Edited by Paris
Link to comment
Share on other sites

You generally don't want to stop execution, there are very few reasons you would ever possibly want execution to stop temporarily. You may want to use Javascript to send requests to PHP periodically to update the page. It's hard to give suggestions without knowing what you're trying to accomplish.

Link to comment
Share on other sites

Hi, I am trying to accomplish something like this....when a member of my datingsite send a Ecard to another member there is first a preview of the Ecard and than he / she push the send button.....after that there is a instant line say: your Ecard has been send to '(lets say) Mary'...I want to show first a sendprogressbar/animation (thats the postecard.gif) and after 3 sec. the echo :.. your Ecard has been send to '(lets say) Mary'...regardsParis

Link to comment
Share on other sites

It's probably best to achieve that with JavaScript. Load the page that holds the progress animation, from it, send a request to a separate PHP that does the sending, and once it's done, remove the animation and replace the contents with a "done" message.You can send the separate HTTP request with XMLHttpRequest.For accessibility's sake, you should probably make the send button initially send people to the actual page (not the one with the animation), and make JavaScript replace that with the animation page. That way, a user without JavaScript can still send the card, but won't see a progressbar while he's waiting.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...