Question

I have a contact form in my html page .where in a iframe src with a html contactus form .once the contact us form is submitted to a thanks.php form . the out put will be the html thanks message from thanks.php file is displaying . now my requirement is after showing this thanks message for 5 seconds ,I need to reload the contactus html form again.

Please kindly help me on this

Was it helpful?

Solution

This can be accomplished with JavaScript. Set a timer for 5 seconds and set the window location to your Contact Us page. Here's how you'd do this:

<script type="text/javascript">
    // Set timeout to 5 seconds, measured in milliseconds
    setTimeout(function () {
        window.location = "contactus.html"; // relative URL
    }, 5000);
</script>

OTHER TIPS

you can use this php code in thanks.php

header( "refresh:5;url=contactus.html" );

this will redirect you to contactus.html at every 5 seconds, but this won't work if you are printing thankyou message, because header() only work if there is no any output before it runs,

so now you can use javascript ,

setTimeout(function () {
   window.location.href= 'http://localhost/xxx/contactus.html'; // the redirect goes here

},5000); // 5 seconds

put this script in your thankyou.php file.

UPDATE : meta tags also can be used in thankyou.php just put this line in <head> section

 <meta http-equiv="refresh" content="5;url=http://www.yoursite.com">
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top