You are here: Re: Visual feedback during a lenghty operation « PHP Programming Language « IT news, forums, messages
Re: Visual feedback during a lenghty operation

Posted by d on 01/19/06 12:00

"a" <xxxxxxx@pacbell.net> wrote in message
news:8Tyzf.13882$Yu.6140@newssvr27.news.prodigy.net...
> Hi everybody,
>
> 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.
>
> A

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
chunks of javascript at set intervals (not too often otherwise it'll send
megabytes of javascript with a lenghty operation). Every browser I've tried
will execute a <script> tag once it's been flushed in its entirity to the
browser, so you can output chunks of javascript that manipulate the parent
document (say, updates a progress bar or textual display). I've used it for
lenghty operations, and it works like a charm.

dave

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация