If i want to use header(“Location: [url]www.url.com
what i have now is something like this…
[code=php]
<html>
<body>
<?
if($_GET[‘str’] == 1) {
header(“Location: [url]http://www.yahoo.com[/url]”);
}
?>
</body>
</html>
i want the script to be directed to another site when the get string, “str”, is equals to 1. but if i were to do this, i think this wont work and i will get an error like…
Warning: Cannot modify header information – headers already sent by (output started at /home/usr/public_html/admin/login.php:25) in /home/usr/public_html/admin/login.php on line 53
i example i gave above is not what i had in the script but the meaning is exactly the same. I have an output before the start of my script and after a session_start function. when i login the script and the session variable returns true, i want it to direct the page to another page. but i get an error of cannot modify header information.
redirection may not be the only case. in some cases when i want to change the charset of the document if any condition is met, i have to use headers as well and chances are i will get this error too.
how should i solve this problem?
thanks