Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8160815
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T18:21:43+00:00 2026-06-06T18:21:43+00:00

I have the following php code which I want to add a delay too:

  • 0

I have the following php code which I want to add a delay too:

<?php
    echo "Message has been sent.";
    header("Location: page2.php", true, 303);
    exit;
?>

The above code happens too fast so I can’t see the message:

I have tried:

<?php
    sleep(5);
    echo "Message has been sent.";
    header("Location: page2.php", true, 303);
    exit;
?>

This doesn’t display the message either, but it does sleep for 5 seconds, which is just a waste of time.

How do I get it to display a message for 5 second before redirecting?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T18:21:44+00:00Added an answer on June 6, 2026 at 6:21 pm

    You cannot do this with a HTTP location redirect, as this redirect will happen as soon as the browser gets the header. Instead, use a refresh redirect in the header:

    header( "Refresh:5; url=http://www.example.com/page2.php", true, 303);
    

    This should work on modern browsers, however it is not standardized, so to get the equivalent functionality would be do use a meta refresh redirect (meaning you’d have to output a full HTML too):

    <meta http-equiv="refresh" content="5;url=http://www.example.com/page2.php"> 
    

    From the Wikipedia page:

    Used in redirection, or when a new resource has been created. This
    refresh redirects after X seconds. This is a proprietary, non-standard
    header extension introduced by Netscape and supported by most web
    browsers.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code: <div><strong>Name: </strong><?php echo anchor('http://'.$link, $row->Name); ?></div> Which takes a
I have the following code of which I want to echo array elements separated
I have the following PHP code which works out the possible combinations from a
I have the following lines of php code which should rename a file which
I have the following piece of code which outputs a long article: <?php the_content();
I have the following PHP Code #The facebook message $fh = fopen('comments.txt', 'r') or
i have following php code which display company logo <?php $key=$_GET['key']; /// key process
I have drawn up the following PHP code which processes the data from a
I have the following code. I want to add/remove check-box values to an array
I have following PHP code $val=<div id=user.$row['cid']. userid=.$row['cid']. class=innertxt><img src=images/images.jpg width=50 height=50><strong>.$uname.</strong><ul> <li>Email: .$row['cemail'].</li>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.