Re: How to preserve value , this question so difficult
| From: | J.Veenhuijsen | Date: | Thu, 14 Aug 2003 06:28:54 +0000 |
| Subject: | Re: How to preserve value , this question so difficult | ||
| References: | 1 2 3 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-21145@lists.php.net to get a copy of this message | ||
It is not a browser warning but a warning from the php interpretor!
The out put you see is generated by php.exe
Jochem
Thomas Edward Lawrence wrote:
Excellent , thank so much , and I also want to ask why my browser warns this when I run page1.php at first time , whether I must make something in php.ini , I use IE6 , win2k , thank for your anwsering . Warning: Cannot send session cookie - headers already sent by (output started at C:\PHP\baitap\session.php:11) in C:\PHP\baitap\session.php on line 12 Warning: Cannot send session cache limiter - headers already sent (output started at C:\PHP\baitap\session.php:11) in C:\PHP\baitap\session.php on line 12 Notice: Undefined index: value in C:\PHP\baitap\session.php on line 13 1 Next page "J.Veenhuijsen" <info@solid-digital.nl> wrote in message news:3F3A55F2.2060708@solid-digital.nl...Try this for page 2: <?php session_start() ; ?> <form method="POST" action="page1.php"> <?php $value++ ; echo $value ; ?> <br> <input type="submit" value="Submit" name="B1"> </form> In your version session_start() should be sent before any other output is sent. Jochem Thomas Edward Lawrence wrote:started at C:\PHP\page1.php:9) in C:\PHP\\page1.php on line 10this is page1.php <? session_start() ; echo $value ; if (!session_is_registered("value") ) { session_register("value") ; $value = 1 ; } echo $value ; ?> <br> <a href="page2.php">Next page</a> this is page2.php <form method="POST" action="page1.php"> <? session_start() ; $value++ ; echo $value ; ?> <br> <input type="submit" value="Submit" name="B1"> </form> when I come back to page1.php from page2.php , this is result : page1.php ( run at first time) Warning: Cannot send session cookie - headers already sent by (output(output started at C:\PHP\page1.php:9) in C:\PHP\page1.php on line 10Warning: Cannot send session cache limiter - headers already sent(output started at C:\PHP\page2.php :10) in C:\PHP\page2.php on line 11Notice: Undefined variable: value in C:\PHP\page1.php on line 11 1 (value of $value) Next page page2.php Warning: Cannot send session cache limiter - headers already sentstarted at C:\PHP\page1.php :9) in C:\PHP\page1.php on line 102 (value of $value) page1.php ( when come back from page2.php) Warning: Cannot send session cookie - headers already sent by (output(output started at C:\PHP\page1.php:9) in C:\PHP\page1.php on line 10Warning: Cannot send session cache limiter - headers already sent(browser not understanding $value)Notice: Undefined variable: value in C:\PHP\page1.php on line 11difficult , I also want to ask why my browser warns , how I must config in php.ini , I use IE6 , win2k , thank for reading .1 (value of $value still 1) Next page Nothing changes , value of $value still is 1 , this question is so