Solved

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

Posted on 2010-09-12
6
326 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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 108

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

These days socially coordinated efforts have turned into a critical requirement for enterprises.
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

895 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now