RE: [PHP-DB] problem with starting a session
| From: | Ford, Mike [LSS] | Date: | Tue, 15 Jul 2003 09:29:06 +0000 |
| Subject: | RE: [PHP-DB] problem with starting a session | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-29258@lists.php.net to get a copy of this message | ||
> -----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