Faking it with Javascript doesn't really work because the termination of the 
Javascript isn't tied to the completion of the processing. Here's how we're doing it 
for a new anti-spam product:

 

results.html

<?php

if ($display):

            // display results

else:

            // save form info

            header("Location: wait.php");

endif;

?>

 

When the user is sent to results.html (the first time) it save the info and sends them 
to wait.php

 

wait.php

<?php

if ($view):

            echo "<center><P CLASS=title>Checking</P>

            <BR><embed width=125 height=25 src='images/progress_bar.swf'></center>";

else:

            echo "<html>

            <FRAMESET rows='0,*' FRAMEBORDER=NO noresize>

            <frame name=control src='processor.php' FRAMEBORDER=NO noresize>

            <frame name=view src='$PHP_SELF?view=T'>

            </frameset>

            </html>";

endif;

?>

 

wait.php spawns 2 windows: One, which is invisible, runs your processing script and 
the other, a normal window, shows your animated “processing” gif.

 

processor.php

<?php

// do all the processing

echo "<html><body 
onLoad=\"top.location='results.html?any_info_to_pass_to_display_page';\"></body></html>";

?>

 

processor.php does the actual work in its invisible window. When it’s finished, it 
loads the results page on top of the window which was displaying the “processing” 
info. 

 

If the results page needs only a little bit of info from the processing, and you don’t 
mind showing it, you can pass it via the URL. Or, you can store the info in a database 
table and have the results page access it from there.

 

Hope this helps,

 

Jeff



---------------------------------
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day

Reply via email to