RE: [PHP-DB] problem with starting a session

From: Date: Wed, 16 Jul 2003 02:01:21 +0000
Subject: RE: [PHP-DB] problem with starting a session
Groups: php.db 
Request: Send a blank email to php-db+get-29274@lists.php.net to get a copy of this message
To make it little more clear, always write session_start() on the top of the page. Because if you output some thing to the browser without starting a session will show you these kind of error. -Sourabh
From: "Ford, Mike               [LSS]" <M.Ford@lmu.ac.uk>
To: 'Ahmed Abdelaliem' <ahmed_abdelaliem@hotmail.com>, php-db@lists.php.net Subject: RE: [PHP-DB] problem with starting a session Date: Tue, 15 Jul 2003 10:29:06 +0100 -----Original Message----- From: Ahmed Abdelaliem [mailto:ahmed_abdelaliem@hotmail.com] Sent: 15 July 2003 08:54 i have a problem with starting a session in the page that validates the user input and sends it tothe database, when the user clicks register he gets this error Warning: session_start(): Cannot send session cookie - headers already sent by (output started at c:\inetpub\wwwroot\ads4u\data_valid_fns.php:25) in c:\inetpub\wwwroot\ads4u\register_new.php on line 89 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at c:\inetpub\wwwroot\ads4u\data_valid_fns.php:25) in c:\inetpub\wwwroot\ads4u\register_new.php on line 89 and here is the code i wrote : There must be approximately 73 lines before this, as the error message says the session_start() is on line 89. Your problem is that one of those lines is an include/require for data_valid_fns.php, and line 25 of that file outputs something that can't be output before the session_start(). Take a look there and work out how you can fix that. <?
     $email=$HTTP_POST_VARS['email'];
     $passwd=$HTTP_POST_VARS['passwd'];
     $passwd2=$HTTP_POST_VARS['passwd2'];
     $title=$HTTP_POST_VARS['title'];
     $name1=$HTTP_POST_VARS['name1'];
     $name2=$HTTP_POST_VARS['name2'];
     $phone=$HTTP_POST_VARS['phone'];
     $mobile=$HTTP_POST_VARS['mobile'];
     $address1=$HTTP_POST_VARS['address1'];
     $address2=$HTTP_POST_VARS['address2'];
     $town=$HTTP_POST_VARS['town'];
     $pb=$HTTP_POST_VARS['pb'];
     $country=$HTTP_POST_VARS['country'];
     $occupation=$HTTP_POST_VARS['occupation'];
session_start(); Cheers! Mike --------------------------------------------------------------------- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: m.ford@lmu.ac.uk
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
_________________________________________________________________ MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. http://join.msn.com/?page=features/virus

« previous php.db (#29274) next »