right place to start a session?
| From: | Kirk Babb | Date: | Sat, 27 Apr 2002 16:46:18 +0000 |
| Subject: | right place to start a session? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-94912@lists.php.net to get a copy of this message | ||
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