Posted by �ڦ���b�����}��! on 12/11/06 12:16
�� �ޭz�mnoemail@noemail.com (Nico)�n���ʨ��G
> Hello,
> I tried to upload in my website the following trial php file:
> <FORM METHOD="POST" ACTION="prova.php">
> <b>Combination</b><br><br>
> Element 1: <INPUT NAME="el1" TYPE="TEXT">
> <BR>
> Element 2: <INPUT NAME="el2" TYPE="TEXT">
> <br>
> <INPUT TYPE="SUBMIT" VALUE"Submit">
> </FORM>
> <br>
> Combination<br><br>
> <?php
> session_start();
> $_SESSION["combinations"][] = ($_REQUEST["el1"].$_REQUEST["el2"]);
> print_r($_SESSION["combinations"]);
> ?>
> As result, I obtain the following error:
> Warning: session_start() [function.session-start]: Cannot send session
> cookie - headers already sent by (output started at
> /home/httpd/docs/prova.php:12) in /home/httpd/docs/prova.php on line 13
> Warning: session_start() [function.session-start]: Cannot send session
> cache limiter - headers already sent (output started at
> /home/httpd/docs/prova.php:12) in /home/httpd/docs/prova.php on line 13
> Sessions don't work.
> Can you help me to understand which is the problem and how can I solve
> it please?
> Many thanks.
> Cheers,
> Nico
It cannot output anything before session_start().
In your case, just place session_start() at first line, like this:
<?php
session_start();
?>
<FORM .........
.....
</FORM>
<br>
Combination<br><br>
<?php
$_SESSION["combinations"][] = ($_REQUEST["el1"].$_REQUEST["el2"]);
print_r($_SESSION["combinations"]);
?>
try it!
--
[1;37m���������� [m�q�w�w�w�w�w�w�w�w�w�w�w�w�w�w�w�w�w�w�w�w�w�w�w�w��[m
[1;37m��[33m�g�X [37m�� [m�x[1;37m�� [35mOrigin�G[1;32m[ �g �X �~ �� ] whshs.cs.nccu.edu.tw[m ���w��
[1;37m�� [33m�~��[37m��[m �q�� [1;33m< IP�G140.119.164.252 >[0;37m ���w��
[1;37m���������� [m �� [1;37m ��[36m From[1;30m�G220-137-59-207.dynamic.hinet.net [m
[1;37;44m �w���w���w [33m�٢բТТ�[37m �w [32m��[36m �C��"BBS"��[4;37m�g�X[m[1;36;44m�����F�ݩ�[4;37m�~��[;1;36;44m�����g��m [32m�� [m
[Back to original message]
|