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

  • Home
  • SEARCH
  • 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 8498901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T00:31:40+00:00 2026-06-11T00:31:40+00:00

I have the following dumb code: <? echo <html><br><br><br><div id=’loading’><p><img src=’loader.gif’> Please wait 6

  • 0

I have the following dumb code:

<?

echo "<html><br><br><br><div id='loading'><p><img src='loader.gif'> Please wait 6 seconds...</p></div></html>";
sleep(6);
header('Location: http://google.com/');

?>

Why doesn’t the HTML piece of code show up in the browser before sleeping 6 seconds and then redirecting? The codes doesn’t output the HTML code at all, waits 6 seconds then sends me to the location. What do I do wrong?

  • 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-11T00:31:41+00:00Added an answer on June 11, 2026 at 12:31 am

    You would need to do something like (this won’t work):

    <?php
    
    echo "<html><br><br><br><div id='loading'><p><img src='loader.gif'> Please wait 6 seconds...</p></div></html>";
    @ob_flush(); //flush the output buffer
    flush(); //flush anything else
    sleep(6); //wait
    header('Location: http://google.com/'); //redirect
    
    ?>
    

    However: This won’t work as expected, you cannot redirect the browser after sending content (PHP will throw and error and tell you this)

    Instead you should:

    <?php
    
    echo "<html><meta http-equiv=\"refresh\" content=\"6;URL='http://YOURURL.com/'\"><br><br><br><div id='loading'><p><img src='loader.gif'> Please wait 6 seconds...</p></div></html>";
    
    ?>
    

    Where the <meta http-equiv="refresh" content="6;URL='http://YOURURL.com/'"> tag is an HTML tag to tell the browser to change to the provided url after 6 seconds

    To avoid adding the meta tag, you could also do this:

    <?php
    header('Refresh: 6;URL=http://www.YOURURL.com/');
    echo "<html><br><br><br><div id='loading'><p><img src='loader.gif'> Please wait 6 seconds...</p></div></html>"
    ?>
    

    But to be safe you should add both the header and the meta tag!

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

Sidebar

Related Questions

To dumb it down, I have the following code highlighting my exact problem: <!DOCTYPE
I have the following dumb test code: #lang racket (define vars '('g1 'g2 'g3
I have following div in a page (I can not modify). <div id=:0.control>Click me</div>
I have following code in initialization im = imread('Image02.tif'); figure(); imagesc(im); colormap(gray); [hImage hfig
I have the following code in PHP: if (preg_match('@^[a-z0-9/._-]+$@i', $script) && !preg_match('@([.][.])|([.]/)|(//)@', $script)) I'm
Following the quickstart on liquibase i've created a changeset (very dumb :) ) Code:
I have the following code, and for the life of me, I cannot understand
So I have a master page in MVC that has the following code in
I have the following dumb test: (define-syntax a (lambda (stx) (syntax-case stx () [(k
Maybe this is a dumb question, but I have the following behavior in Visual

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.