Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Visual feedback during a lenghty operation
January 18, 2006, 9:59 pm
rate this thread
I have a form that is processed by a php script. When the user presses
Submit, the php script calls exec to start an external process that may take
from seconds to minutes to complete, and in the meantime I would like to
show the user some feedback as to the progress of the operation.
One problem is that exec is synchronous - how do I start an external process
asynchronously? The second issue is that even if I start a process
asynchronously, I don't know how to send a page to the browser without
exiting the script. For example, while waiting for the external process to
finish its work, I would be in a loop, and every X seconds I would update
the page with some new information, but I'm not sure how to do that.
I have php 5.2.2 and Apache 2 on Win XP Pro.
I would appreciate any hints.
- Janwillem Borleffs
January 18, 2006, 10:33 pm
Re: Visual feedback during a lenghty operation
Call the php script in an iframe in your web page (the iframe can be
invisible, and can be the target for your form). Have the script output
will execute a <script> tag once it's been flushed in its entirity to the
document (say, updates a progress bar or textual display). I've used it for
lenghty operations, and it works like a charm.