I've read all the suggestions on this site for using the header function properly and I'm still having trouble. I know that the header function must be called before any output is sent but I should be able to set session variables before calling the header function right? What I am trying to do is obtain the username and password from the user, check it against the valid usernames/passwords in my database, and redirect them to the first page of my site. Each page after login checks the session variable to ensure the user logged in properly. The very simple code snippet below does not work:
<?php
//SET THE VALUES FOR TESTING PURPOSES
session_start();
session_register("loggedin"
$loggedin = true;
header("Location:
?>
this is the error:
Warning: Cannot add header information - headers already sent by (output started at c:\inetpub\ in c:\inetpub\ on line 9
Can I not assign the session vars before I call the header? Is there a better/another way to redirect? The only way I could get the header function to work was by having nothing else but that function:
<?php
header("Location: ?>
So I know the header function is working properly on my system. Any help is greatly appreciated.
thanks
<?php
//SET THE VALUES FOR TESTING PURPOSES
session_start();
session_register("loggedin"
$loggedin = true;
header("Location:
?>
this is the error:
Warning: Cannot add header information - headers already sent by (output started at c:\inetpub\ in c:\inetpub\ on line 9
Can I not assign the session vars before I call the header? Is there a better/another way to redirect? The only way I could get the header function to work was by having nothing else but that function:
<?php
header("Location: ?>
So I know the header function is working properly on my system. Any help is greatly appreciated.
thanks