You are here: Re: "header" call doesn't work before lenghty operation « PHP Programming Language « IT news, forums, messages
Re: "header" call doesn't work before lenghty operation

Posted by Jim Michaels on 02/18/06 03:48

"a" <xxxxxxx@pacbell.net> wrote in message
news:sstJf.9022$rL5.3878@newssvr27.news.prodigy.net...
> Hi everybody,
>
> My config: Win XP (or 2003), Apache 2.0.54, PHP 5.1.2.
>
> I have been trying to handle the case of a lenghty opearation on the
> server while providing the user with feedback and ability to cancel, and
> nothing seems to work so far.
>
> The following code is one attempt to address this, and it is called as
> result of a POST:
>
> //*************start code***************
> session_start;
>
> // prepare exec
>
> // flush session data
> session_write_close;
>
> // trying to display a "Please wait..." message:
> header( "Location: please_wait.php" );

Location should be followed immediately by exit, at least according to the
documentation. it is supposed to transfer you to a new URL. your long exec
and other header should be in your please wait page, but the header cannot
be, because header() only works at the top of the document before any HTML
is output and before any blank lines (I wouldn't even trust whitespace) are
seen. after all your headers are output, then output a blank line to show
end of headers and then your HTML. sorry. you only get one header() per
page.


>
> // long exec
> exec( ... );
>
> // finally show the result of the exec
> header( "Location: exec_result.php" );
> //************end code*******************
>
> What happens is that only the last header statement has a visual effect,
> the first one doesn't do anything, so the user is not presented with the
> "Please wait message".
>
> I would appreciate any ideas or code examples on this or the issue of
> handling this sort of lengthy operations in general.
>
> Thanks,
>
> A
>

 

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

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