hi to all, i have a problem with code.
this
$result = $db->sql_query("UPDATE ".$prefix."_gax_wbox SET......'");
Header("Location: ".$adminfile.".php?adminload=$modulename&plugin=Proyectos");
}
it works well
this
if($choice == "No"){
Header("Location: ".$adminfile.".php?adminload=$modulename&plugin=Admin_Mensajes");
}
it works bad
this says brownser:
Warning: Cannot add header information - headers already sent by (output started at d:\easyphp\www\zentri\core.php:662) in d:\easyphp\www\zentri\plugins\admin\GaxBox\plugins\Admin_Mensajes\index.php on line 39
What is the problem??
somebody can help me?
thanks
You know it has to be before ANYTHING is outputted. Also, if you use both of those, you should make sure that the first one is not used when the second one is.
This issue is not a General CHat topic. It is a scripting question. Thusly, it should be in the Scripting forum,
Moved
Actully u r sending header after sending body elements
i far i know in php it is not allowed
so u have to check that carefully in source code also check this out
http://www.oreilly.com/catalog/phpckbk/chapter/ch08.pdf
as everyone else has already said the header tag can only be used before anything is shown such as text etc but not processing.
As the time cannot be set before the redirection there really is very little point in displaying anything so unless your displaying errors and havent excluded it theres no point for anything apart from the processing and the header command.
If however you do want other info displayed or want a certain amount of time before the redirection takes place you should consider using a meta version
| Code: |
| <META HTTP-EQUIV="Refresh" CONTENT="5; URL=http://site.com/index.html"> |
Here the content controls first the time and then the url. To be html valid it should be in the head section of your site but will work if no head or body tags are used, before or after anything is displayed.
you can use that or post your code up and we'll see if it can sorted 
I wouldn't recommend Meta Refresh because there is an option for people to turn it off in their browser.
- Mike.
use gzip on your page, which stores the output of the script, runs the headers, then shows the output so that error doesn't show. normally you have to output headers before anything else is outputted to the screen.
| markgil wrote: |
hi to all, i have a problem with code.
this
$result = $db->sql_query("UPDATE ".$prefix."_gax_wbox SET......'");
Header("Location: ".$adminfile.".php?adminload=$modulename&plugin=Proyectos");
}
it works well
this
if($choice == "No"){
Header("Location: ".$adminfile.".php?adminload=$modulename&plugin=Admin_Mensajes");
}
it works bad
this says brownser:
Warning: Cannot add header information - headers already sent by (output started at d:\easyphp\www\zentri\core.php:662) in d:\easyphp\www\zentri\plugins\admin\GaxBox\plugins\Admin_Mensajes\index.php on line 39
What is the problem??
somebody can help me?
thanks |
You can check in file core.php and index.php if there is one of following:
- blank characters: space, line break, ...
- send cookie before call function header() ???
This problem occurs when you have output some data before a Header(Location). Looks like in your case, the output was done in file
d:\easyphp\www\zentri\core.php
Line number 662.
see that you do not have output any data before header method. It should solve the problem.
One more solution for redirect using html+javascript
| Code: |
<form name="auto" action="dest_url"></form>
<script>
document.auto.submit()
</script>
|
you can even pass some POST-parameters in that way.
Good luck.