The session_start() needs to come before any code outputs anything to 
the browser, so in your case you need to put it before the <html> and 
<body> tags:

<?php

session_start();

?>
<html>
<body>
<?

etc...


Padraig


Kirk Babb wrote:
> Here's my code:
> <html>
> <body>
> <?php
>     //trying to start a session right here for the usr and pwd variables
>     session_start();
>     session_register("usr", "pwd");
>     if (isset($login)):
> ?>
> <FORM ACTION='<?php echo($PHP_SELF); ?> 
> 
> etc., etc where the usr enters their usrname and pwd but I get the following errors:
> 
> Warning: Cannot send session cookie - headers already sent by (output started at 
>c:\program files\apache group\apache\htdocs\newsadmin\news.php:3) in c:\program 
>files\apache group\apache\htdocs\newsadmin\news.php on line 5
> 
> Warning: Cannot send session cache limiter - headers already sent (output started at 
>c:\program files\apache group\apache\htdocs\newsadmin\news.php:3) in c:\program 
>files\apache group\apache\htdocs\newsadmin\news.php on line 5
> 
> Have tried moving the session to the next part of the script after the form posts to 
>self with no success.  I would like to "keep" the usr and pwd variables for use later 
>since it involves multiple queries to MySQL, right now I have to have the information 
>entered "AGAIN!" and I know that is a pain for users.  Please help me out - there are 
>several <form>'s in the script using $PHP_SELF and it seems sessions is the way to 
>go.  I'm in need of a good samaritan here...
> 
> Thanks!  -Kirk
> 




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to