Solved

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

Posted on 2010-09-12
6
330 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
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 
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

Industry Leaders: 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!

Question has a verified solution.

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

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

724 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