note 46171 deleted from function.header by tomsommer
| From: | tomsommer@php.net | Date: | Fri, 01 Oct 2004 20:46:57 +0000 |
| Subject: | note 46171 deleted from function.header by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-77714@lists.php.net to get a copy of this message | ||
Note Submitter: mae at tidas dot com
----
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;
?>