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 a on 02/18/06 05:29

Thanks for your reply.
>
> 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.
>

Here is a new attempt, but I still don't see the Please Wait page, instead
it goes straight to the show_result.php

//*********** the form processing.php code************

// long exec (asynchronous - it exits immediately but continues processing),
its end will tested in the next script
exec( ... );

header( "Location: please_wait.php" );

echo( "\nPlease wait" );

flush;
exit;
*********** end of form processing

//********** the "please wait.php" code *************
while( long_operation_not_done )
usleep( 100000 ); // check the operation each 0.1 secs

header( "Location: show_result.php" );

exit;
//************ end code *****************

If I put the echo in second php script, I get an error about headers already
sent or similiar.

I don't know php well enough to figure out a solution to unblock me at this
point, so any new idea would be highly appreciated.

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

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