note 46171 added to function.header
| From: | mae at tidas dot com | Date: | Fri, 01 Oct 2004 11:38:09 +0000 |
| Subject: | note 46171 added to function.header | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-77675@lists.php.net to get a copy of this message | ||
I found out when using header('Location: ...'); that opera was unable to refresh the page
unless the location was from the calling url.
Say you are calling a script from index.php?page=somepage and the script has an header like this:
<?php
// some useful code here....
// all done, redirect back
header('Location: index.php?page=somepage&var=somenewvar'); exit;
?>
Opera calls the script and then stops as nothing happened.
It seems opera is unable to refresh the page unless it is redirected to the exact url it was calling
from.
ob_flush() and flush(); has no effect.
a working example:
<?php
// some useful code here....
// all done, redirect back
header('Location: index.php?page=somepage'); exit;
?>
the above code will work.
However, a little javascript workaround will fix this:
<?php
// some useful code here....
// all done, redirect back
$redirHTML = '<html><head></head><body><script
language="javascript">location =
"index.php?page=somepage&var='.$var.'"</script></body></html>';
echo $someHtml; flush(); ob_flush(); exit;
?>
----
Manual Page -- http://www.php.net/manual/en/function.header.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+46171
Delete -- http://master.php.net/manage/user-notes.php?action=delete+46171&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+46171&report=yes
Search -- http://master.php.net/manage/user-notes.php