could you please explain a little on
print ("<META HTTP-EQUIV='refresh' content='1;URL=mypage.php?
??
I don't know whether my query time is not long enough..so the animated gif does not show in my case..please advise..
Main Topics
Browse All TopicsDear All,
I have a php popup page which connect db to greb some information, but the process takes time..so I would like to have a animated gif with word "processing ... ..." to tell the user the status.
once the db connection is finished, I will ask this popup page to call a javascript to refresh its parent page and then close itself automatically.
but I found that I the gif usually is not loaded and the browser is closed once the query is finished (the browser status is "pending", seems "hold" as not all component are loaded). so I can't have the "loading" effect that I expected.
so what should I do in this case??
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Sure, once the query has run it will (should) return a result, for me thats a 1 if the query is successful or a 0 if its not.
I run my query as such:
$result = mssql_query($query);
IF ($result == "1") {
print ("<META HTTP-EQUIV='refresh' content='$rand;URL=mypage.
}
ELSE {
print ("There has been an error sending your data, please contact System Administrator");
exit(); };
The line "print ("<META HTTP-EQUIV='refresh' content='$rand;URL=mypage.
Sends the browser to another page which prints the results of the query. Otherwise it just outputs an error message
Can you possibly post your code?
the query that I have to execute...can said to be a "small program"..it includes several process...and some of them related to pop3 server connection..
and the page ordering should be
main.php -> onLoad -> then call popup -> popup.php execute the "small program that I mention and at the same time would like to have the loading effect (but not successful now..) -> once the "program" is finished -> call the parent page to refresh and close itself
thanks,
but..
this refresh statement refresh do not refresh the parent page in my case?
so I use
echo("<script language=\"Javascript\">")
echo("window.opener.locati
echo("self.close();");
echo("</script>");
actually I the animated gif code is already located first, and the php code follows..but I still can't have the loading effect..
I have already output html before the execution of php...
finially..I've got a solution for my problem.
main.php -> onLoad -> then call popup -> popup.php execute the "small program that I mention and at the same time would like to have the loading effect -> once the "program" is finished -> call the parent page to refresh and close itself
in the popup.php, I use frameset..top frame contains only a "processing....." gif and a hidden frame process the code, once the code is processed, it call the parent 's opener to refresh itself and then call parent to close.
Thanks for all of your help!
Try something like this ...
<html>
<head>
<title>KPI Production</title>
<link title="KPI Style Sheet" rel="stylesheet" href="kpi_css.php">
</head>
<body>
<div class="MainDIV">
<a href="/"><img class="LogoIMG" src="./images/bandvulc_kpi
<hr class="MainHR" />
</div>
<div class="PleaseWaitDIV" id="pleasewait">
<h2 class="PleaseWaitH2">
Please wait - generating results
</h2>
This may take some time.<br />
If you want to abort the current operation, then click <a class="PleaseWaitA" href="/index.php">here</a>
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
</div>
<?php
flush();
.....
// Include your PHP code here, but make sure it only generates a $sOutput.
?>
<script language="JavaScript"><!--
pleasewait.style.display = 'none';
document.body.style.cursor
//--></script>
$sOutput
END_HTML;
?>
</body>
</html>
I use this for all my internal apps.
The PleaseWait div shows whilst the page is being generated (normally involves getting data from a DB, sorting it out, building tables or a PDF, etc, and can take several seconds or even minutes if the request is a big analysis). The PHP code builds a text variable for the output (i.e. functions NEVER echo/print, only return) and the main app builds up the output from the functions). I COULD have used output buffering, maybe. But I didn't.
When the output is ready, the javascript "hides" the pleasewait div and then shows the real div.
Also, the cursor is changed from "busy" to "ready".
Only tested on Windows, IE6.
The please wait div COULD include any sort of output you want. An image which could be a flash thing which looks at a counter the main php code is generating maybe, to give you some sort of real time feedback.
Regards,
Richard.
This is what I do on my pages:
<html>
<head>
<script type="text/javascript" language="javascript">
function swapContent(divID, srcDivID)
{
document.getElementById(di
document.innerHTML = document.getElementById(sr
}
</script>
</head>
<body marginheight="0" marginwidth="0" leftmargin="0" topmargin="0">
<DIV id='Wait_Text' STYLE="position:absolute; top:200;left:200; border:none thin gray;z-index:300">
<table width="*" cellpadding="3" cellspacing="1" border="0" class="forumline">
<td class="Open"><h1>Please wait while the data is being processed...</h1.</td>
</table>
</DIV>
<?
flush();
?>
<div id='Good' 'display:none;z-index:200'
<?
//Your PHP goes here
sleep(10);
print("PHP is done!");
//---------------------
?>
</div>
<SCRIPT LANGUAGE="JavaScript"><!--
</body>
</html>
Sorry my last comment had a cut and paste error which made it wrong. here is the code which I tested and works:
<html>
<head>
<script type="text/javascript" language="javascript">
function swapContent(divID, srcDivID)
{
document.getElementById(di
document.innerHTML = document.getElementById(sr
}
</script>
</head>
<body marginheight="0" marginwidth="0" leftmargin="0" topmargin="0">
<DIV id='Wait_Text' STYLE="position:absolute; top:200;left:200; border:none thin gray;z-index:300">
<table width="*" cellpadding="3" cellspacing="1" border="0" class="forumline">
<td class="Open"><h1>Please wait while the data is being processed...</h1.</td>
</table>
</DIV>
<?
flush();
?>
<div id='Good' 'display:none;z-index:200'
<?
//Your PHP goes here
sleep(3);
print("Php is done");
?>
</div>
<SCRIPT LANGUAGE="JavaScript"><!--
swapContent('Wait_Text','G
//--></SCRIPT>
</body>
</html>
Business Accounts
Answer for Membership
by: maundedPosted on 2004-09-13 at 01:49:35ID: 12042154
I have a similar function on one of my sites, I build the page and load the gif first, then run the query, when the query returns its result I use an if statement to do: print ("<META HTTP-EQUIV='refresh' content='1;URL=mypage.php? action=1'> ");