Solved

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

Posted on 2010-09-12
6
327 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
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
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 
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 109

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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

823 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