portal123
asked on
Dreamweaver and PHP sessionVariable and UFT
Hello, I am stuck with PHP session variable problem. My code editor is DreamWeaver MX and I chose UFT-8 with UNICODE signature(BOM) as encode setting. But when I use session variables to pass pwd and UserID from one page to a next page, session variable do not work and Error message says like follows:
Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/users/syouhukutei/pu blic_html/ admin/pane l.php:1) in /home/users/syouhukutei/pu blic_html/ admin/pane l.php on line 1
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/users/syouhukutei/pu blic_html/ admin/pane l.php:1) in /home/users/syouhukutei/pu blic_html/ admin/pane l.php on line 1
If someone help me out, I really appreciate it.
portal123
Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/users/syouhukutei/pu
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/users/syouhukutei/pu
If someone help me out, I really appreciate it.
portal123
If you must send another header request, use ob_start() on the very first line and ob_flush() on the very last line.
Usually this can be worked around though, if you post some code we can help you!
Mike
Usually this can be worked around though, if you post some code we can help you!
Mike
ASKER
Hi! I've just put ob_start() on the very first line and ob_flush() on a bottom. But it does not work. Error messages show same warning. My sample codes are belows:
Do you have any ideas to correct codes?
//test1.php
<?PHP ob_start(); session_start();
?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?PHP
$_SESSION['abc']="Hello";
print $_SESSION['abc'];
?>
<form action="test2.php" method="post">
<input type="text" name="name">
<input type="submit" name="submit" value="submit">
</form>
<BR><BR><BR>
<a href="test2.php">test2</a>
<?PHP ob_end_flush() ?>
//test2.php
<?PHP ob_start(); session_start();
?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?PHP
print $_SESSION['abc'];
?>
<?PHP ob_end_flush() ?>
Do you have any ideas to correct codes?
//test1.php
<?PHP ob_start(); session_start();
?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?PHP
$_SESSION['abc']="Hello";
print $_SESSION['abc'];
?>
<form action="test2.php" method="post">
<input type="text" name="name">
<input type="submit" name="submit" value="submit">
</form>
<BR><BR><BR>
<a href="test2.php">test2</a>
<?PHP ob_end_flush() ?>
//test2.php
<?PHP ob_start(); session_start();
?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?PHP
print $_SESSION['abc'];
?>
<?PHP ob_end_flush() ?>
Is there any reason why you are using UTF-8 encoding rather than iso-8859-1 (?)
As this is completely killing the script!
Mike
As this is completely killing the script!
Mike
ASKER
I am using Flash swf file that contains a photo gallery with foreign letters. That Flash file's char set is in UFT code. When I use any other char sets instead of UTF code, tests on a page become really messy, so I used UTF codes.
So, What you mean is that UFT-8 encoding kill script in PHP??
So, What you mean is that UFT-8 encoding kill script in PHP??
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You can only send headers once. The second time in the same script that you send headers you get this error.
So, have a look in "/home/users/syouhukutei/p