Solved

How can I show another page AFTER my php processing has finished?

Posted on 2010-09-12
6
329 Views
Last Modified: 2012-08-14
I'm calling a php script which does some processing.

I want to briefly show some on that page which says "finished".

Then show another page.

I know I could have used this..
Header('Location: http://www.whaterver.com');

But this would allow me to show finished.

What can I do ?
0
Comment
Question by:mindwarpltd
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 33657523
If you want it to appear only briefly, use a 'meta' refresh tag that redirects to the new page after a few seconds.  The '5' in the sample is for 5 seconds.
<meta http-equiv="refresh" content="5;url=http://example.com/" />

Open in new window

0
 

Author Comment

by:mindwarpltd
ID: 33657534
But that won't wait for my page to finished will it ?
0
 
LVL 9

Expert Comment

by:khaledf
ID: 33657550
add this line
header('Location:http://www.example.com');
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 9

Expert Comment

by:khaledf
ID: 33657558
if you get this error

Warning: Cannot modify header information - headers already sent by

then it means you have printed something before the header,
0
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 33657581
Of course it will wait because you will put the HTML code of the page at the end of your PHP code.  Simplistic example below.
<?php
code here...
?>
<html>
<head>
<meta http-equiv="refresh" content="5;url=http://example.com/" />
</head>
<body>
<h1>Finished!</h1>
</body>
<html>

Open in new window

0
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 33657663
DaveBaldwin's answer is correct and will work, but the UX characteristics of this concept are questionable.

1. If what you put on the screen before the redirect does not matter, don't put it on the screen.
2. If what you put on the screen DOES matter, leave it there, so the client can read it.  Give the client a link to move to the next page.  That's the right way to program the client-server relationship.

Best, ~Ray
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question