[PHP-WIN] Re: How to preserve value , this question so difficult

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

 



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 3F3A55F2.2060708@solid-digital.nl">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:

this 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

started at C:\PHP\page1.php:9) in C:\PHP\\page1.php on line 10

Warning: Cannot send session cache limiter - headers already sent

(output started at C:\PHP\page1.php:9) in C:\PHP\page1.php on line 10

Notice: 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 sent

(output started at C:\PHP\page2.php :10) in C:\PHP\page2.php on line 11


2 (value of $value)





page1.php ( when come back from page2.php)


Warning: Cannot send session cookie - headers already sent by (output

started at C:\PHP\page1.php :9) in C:\PHP\page1.php on line 10

Warning: Cannot send session cache limiter - headers already sent

(output started at C:\PHP\page1.php:9) in C:\PHP\page1.php on line 10

Notice: Undefined variable: value in C:\PHP\page1.php on line 11

(browser not understanding $value)

1 (value of $value still 1)


Next page




Nothing changes , value of $value still is 1 , this question is so

difficult , I also want to ask why my browser warns , how I must config in
php.ini , I use IE6 , win2k , thank for reading .










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


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux