Re: sending multiple headers (session_start() and setcookie() )

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ben wrote:
> Hi all,
>
> In my .php file, I'm using both session_start() and setcookie()
before
> <html> tag. It gives me following warning message:
>
> Warning: Cannot modify header information - headers already sent by
> (output started at D:\Apache Group\Apache2\htdocs\YC\songs.php:4) in
> D:\Apache Group\Apache2\htdocs\YC\ycphpfunc.php on line 148
>
> My .php file looks like this:
>
> <?php session_start(); ?>
>
> <?php
> 	ob_start();
> 	include 'ycphpfunc.php';
> 	$login = new login_class;
> 	if ($_POST[logusername] == "" || $_POST[logpassword] == "") {}
> 	else {
> 		$login->check_login($_POST['logusername'], $_POST['logpassword'],
> $_POST['remember']);
> 	}
> 	ob_end_flush();
> ?>

1. Put everything under ob_start()
2. Send all headers (cookies/session/etc) before outputting

--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com    Blog: http://rajeshanbiah.blogspot.com/

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux