Hibaüzenet: Warning: Cannot send session cache limiter - headers already sent
Küzdök egy űrlappal, amit ha helyesen tölt ki a felhasználó, akkor hiba üzenet nélkül működik. Ha a csillagos mezőt nem tölti ki vagy kétszer nem ugyanazt az email címet adja meg vagy értelmetlen időtartamra foglal, akkor a lap tetején a következő hibaüzenet jelenik meg:
Warning: Cannot send session cache limiter - headers already sent (output started at /home/balatonhostel/public_html/urlapenglishh.php:62) in /home/balatonhostel/public_html/main.inc.php on line 2
Idemásolom a teljes kódot, hátha így könnyebben kapok segítséget valakitől. Előre is köszönök minden segítséget
<?php $nekunk= "info##kukac##balatonhostel.hu";
$erkho=$_POST[erkezes_honap];
switch ($erkho) {
case Jan: $erkho=1;
break;
case Feb: $erkho=2;
break;
case Mar: $erkho=3;
break;
case Apr: $erkho=4;
break;
case May: $erkho=5;
break;
case Jun: $erkho=6;
break;
case Jul: $erkho=7;
break;
case Aug: $erkho=8;
break;
case Sep: $erkho=9;
break;
case Oct: $erkho=10;
break;
case Nov: $erkho=11;
default:
$erkho=12;
}
$erknap=$_POST[erkezes_nap];
$erkev=$_POST[erkezes_ev];
$tavho=$_POST[tavozas_honap];
switch ($tavho) {
case Jan: $tavho=1;
break;
case Feb: $tavho=2;
break;
case Mar: $tavho=3;
break;
case Apr: $tavho=4;
break;
case May: $tavho=5;
break;
case Jun: $erkho=6;
break;
case Jul: $tavho=7;
break;
case Aug: $tavho=8;
break;
case Sep: $tavho=9;
break;
case Oct: $tavho=10;
break;
case Nov: $tavho=11;
default:
$tavho=12;
}$tavnap=$_POST[tavozas_nap];
$tavev=$_POST[erkezes_ev];
$checkout=mktime(0,0,0,$tavho,$tavnap,$tavev);
$checkin=mktime(0,0,0,$erkho,$erknap,$erkev);
$period=$checkout-$checkin;
function confirm($msg)
{
echo "<script langauge=\"javascript\">alert(\"".$msg."\");</script>";
}//end function
if (isset($_POST['send'])) {
if(strlen($_POST['nev'])>0 && strlen($_POST['email'])>0 && strlen($_POST['email2'])>0 && strlen($_POST['phone'])>0 ) {
if($_POST['email']==$_POST['email2']) {
if($period>0) {
$n=TRUE;
}else {
$msg="You can not departure earlier than you arrive! Plese check the dates.";
confirm($msg);
}} else {
$msg="The two email fields are not identical; enter your email again and confirm it." ;
confirm($msg);
}} else {
$n=FALSE;
$msg="Please fill all fields marked as * !";
confirm($msg);
}
if ($n) {
foreach($_POST as $key => $post)
{
if(!Empty($post))
{
$mail .= $key . "=" . $post . "\n";
}
}
if($_SERVER['SERVER_NAME'] == 'www.balatonhostel.hu')
{
mail($nekunk,"New reservation",$mail,"X-FW-MailID: " . $freewebxmail);
header('Location: koszonetenglish.html');
exit(); }
}
}
$page_title="Hullam Hostel";
include('./ujheader.inc');?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"><br>
<div style="margin-left: 40px;">
<p>To send a booking request to us, please fill in this form. We'll
send the confirmation of your reservation to your email address within 24
hours. </p>
<p>Fields with * are all required.<br>
</p>
</div>
<div style="text-align: center;"><br>
<br>
<div style="text-align: left; margin-left: 40px;">
<p>Name of the contact person* :
<input type="text" name="nev" value="<?php if (isset($_POST['nev'])) echo $_POST['nev'];?>"/> <br>
<br>
E-mail address for the confirmation *:
<input type="text"
name="email" value="<?php if (isset($_POST['email'])) echo $_POST['email'];?>"/> <br>
<br>
Retype e-mail address *:
<input type="text"
name="email2" value="<?php if (isset($_POST['email2'])) echo $_POST['email2'];?>"/><br>
<br>
Phone (including country code) *:
<input type="text" name="phone" value="<?php if (isset($_POST['phone'])) echo $_POST['nev'];?>"/><br>
<br>
Address of the contact person: country:
<input type="text" name="orszag" value="<?php if (isset($_POST['orszag'])) echo $_POST['orszag'];?>"/> city: <input name="varos" value="<?php if (isset($_POST['varos'])) echo $_POST['varos'];?>"/> <br>
<br>
Number of guests :
<input type="text" size="1" name="letszam" value="<?php if (isset($_POST['letszam'])) echo $_POST['letszam'];?>"/> persons <br>
<br>
Room type:
<select name="szobatipus">
<option>single room </option>
<option>single room ensuited</option>
<option>double room</option>
<option>double room ensuited</option>
<option>triple room</option>
<option>triple room ensuited</option>
<option>quad ensuited</option>
<option>4 bedded mix dorm</option>
<option>4 bedded female dorm</option>
<option>4 bedded male dorm</option>
<option>6 bedded mix dorm</option>
</select>
number of rooms :
<select name="szobak szama">
<option>0</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
<option>9</option>
</select>
extra beds:
<select name="potagyak szama">
<option>0</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option></option>
</select>
<br>
<br>
Date of arrival:
<select name="erkezes_honap"> <?php if (isset ($_GET['Month'])) { $select = $_GET['Month'] ;}
else {$select = Date('M') ; }?> <option value="Jan" <?php if($select == "Jan"){ echo 'selected="selected"';} ?> />Jan</option>
<option value="Feb" <?php if($select == "Feb"){ echo 'selected="selected"';} ?> />Feb</option>
<option value="Mar" <?php if($select == "Mar"){ echo 'selected="selected"';} ?> />Mar</option>
<option value="Apr" <?php if($select == "Apr"){ echo 'selected="selected"';} ?> />Apr</option>
<option value="May" <?php if($select == "May"){ echo 'selected="selected"';} ?> />May</option>
<option value="Jun" <?php if($select == "Jun"){ echo 'selected="selected"';} ?> />Jun</option>
<option value="Jul" <?php if($select == "Jul"){ echo 'selected="selected"';} ?> />Jul</option>
<option value="Aug" <?php if($select == "Aug"){ echo 'selected="selected"';} ?> />Aug</option>
<option value="Sep" <?php if($select == "Sep"){ echo 'selected="selected"';} ?> />Sep</option>
<option value="Oct" <?php if($select == "Oct"){ echo 'selected="selected"';} ?> />Oct</option>
<option value="Nov" <?php if($select == "Nov"){ echo 'selected="selected"';} ?> />Nov</option>
<option value="Dec" <?php if($select == "Dec"){ echo 'selected="selected"';} ?> />Dec</option></select>
<select name="erkezes_nap"><?php if (isset ($_GET['Day'])) {
$select = $_GET['Day'] ;
}
else {
$select = Date('d') ;
}
for ($i=1; $i<=31;$i ++){
$option .= "<option value=\"" . $i . "\"" ;
if ($select == $i) {
$option .= " selected=\"selected\""; }
$option .= ">" . $i . "</option>" ;
}
echo $option ;?> </select>
<select name="erkezes_ev"><?php if (isset ($_GET['Year'])) {
$selecterkev = $_GET['Year'] ;
}
else {
$selecterkev = Date('Y') ;
}
for ($year=2007; $year<=2009;$year ++){
$optionerkev .= "<option value=\"" . $year . "\"" ;
if ($selecterkev == $year) {
$optionerkev .= " selected=\"selected\"";
}
$optionerkev .= ">" . $year . "</option>" ;
}
echo $optionerkev ;?> </select>
</p>
<p> Number of nights:
<input size="1"
name="ejszakak szama" value="<?php if (isset($_POST['ejszakak szama'])) echo $_POST['ejszakak szama']; ?>"/>
<br>
<br>
Date of departure:
<select name="tavozas_honap"><?php if (isset ($_GET['Month'])) { $select = $_GET['Month'] ;}else {
$select = Date('M') ; } ?> <option value="Jan" <?php if($select == "Jan"){ echo 'selected="selected"';} ?> />Jan</option>
<option value="Feb" <?php if($select == "Feb"){ echo 'selected="selected"';} ?> />Feb</option>
<option value="Mar" <?php if($select == "Mar"){ echo 'selected="selected"';} ?> />Mar</option>
<option value="Apr" <?php if($select == "Apr"){ echo 'selected="selected"';} ?> />Apr</option>
<option value="May" <?php if($select == "May"){ echo 'selected="selected"';} ?> />May</option>
<option value="Jun" <?php if($select == "Jun"){ echo 'selected="selected"';} ?> />Jun</option>
<option value="Jul" <?php if($select == "Jul"){ echo 'selected="selected"';} ?> />Jul</option>
<option value="Aug" <?php if($select == "Aug"){ echo 'selected="selected"';} ?> />Aug</option>
<option value="Sep" <?php if($select == "Sep"){ echo 'selected="selected"';} ?> />Sep</option>
<option value="Oct" <?php if($select == "Oct"){ echo 'selected="selected"';} ?> />Oct</option>
<option value="Nov" <?php if($select == "Nov"){ echo 'selected="selected"';} ?> />Nov</option>
<option value="Dec" <?php if($select == "Dec"){ echo 'selected="selected"';} ?> />Dec</option>
</select>
<select name="tavozas_nap"><?php if (isset ($_GET['Day'])) {
$selecttavnap = $_GET['Day'] ;
}
else {
$selecttavnap = Date('d') ;
}
for ($j=1; $j<=31;$j ++){
$optiontavnap .= "<option value=\"" . $j . "\"" ;
if ($selecttavnap == $j) {
$optiontavnap .= " selected=\"selected\""; }
$optiontavnap .= ">" . $j . "</option>" ;
}
echo $optiontavnap ; ?></select>
<select name="tavozas_ev"><?php if (isset ($_GET['Year'])) {
$selecttavev = $_GET['Year'] ;
}
else {
$selecttavev = Date('Y') ;
}
for ($year=2007; $year<=2009;$year ++){
$optiontavev .= "<option value=\"" . $year . "\"" ;
if ($selecttavev == $year) {
$optiontavev .= " selected=\"selected\"";
}
$optiontavev .= ">" . $year . "</option>" ;
}
echo $optiontavev ; ?> </select>
<br>
</p>
<p><br>
Comments and requests:<br>
<textarea cols="20" rows="5"
name="uzenet"></textarea>
<br>
</p>
<div style="text-align: left;"> <br>
</div>
<div style="text-align: left;"><br>
</div>
<br>
<br>
<center> <input name="send"
value="SEND" type="submit"> </center>
<br>
<br>
</div>
</div>
</form>
■ Warning: Cannot send session cache limiter - headers already sent (output started at /home/balatonhostel/public_html/urlapenglishh.php:62) in /home/balatonhostel/public_html/main.inc.php on line 2
Idemásolom a teljes kódot, hátha így könnyebben kapok segítséget valakitől. Előre is köszönök minden segítséget
<?php $nekunk= "info##kukac##balatonhostel.hu";
$erkho=$_POST[erkezes_honap];
switch ($erkho) {
case Jan: $erkho=1;
break;
case Feb: $erkho=2;
break;
case Mar: $erkho=3;
break;
case Apr: $erkho=4;
break;
case May: $erkho=5;
break;
case Jun: $erkho=6;
break;
case Jul: $erkho=7;
break;
case Aug: $erkho=8;
break;
case Sep: $erkho=9;
break;
case Oct: $erkho=10;
break;
case Nov: $erkho=11;
default:
$erkho=12;
}
$erknap=$_POST[erkezes_nap];
$erkev=$_POST[erkezes_ev];
$tavho=$_POST[tavozas_honap];
switch ($tavho) {
case Jan: $tavho=1;
break;
case Feb: $tavho=2;
break;
case Mar: $tavho=3;
break;
case Apr: $tavho=4;
break;
case May: $tavho=5;
break;
case Jun: $erkho=6;
break;
case Jul: $tavho=7;
break;
case Aug: $tavho=8;
break;
case Sep: $tavho=9;
break;
case Oct: $tavho=10;
break;
case Nov: $tavho=11;
default:
$tavho=12;
}$tavnap=$_POST[tavozas_nap];
$tavev=$_POST[erkezes_ev];
$checkout=mktime(0,0,0,$tavho,$tavnap,$tavev);
$checkin=mktime(0,0,0,$erkho,$erknap,$erkev);
$period=$checkout-$checkin;
function confirm($msg)
{
echo "<script langauge=\"javascript\">alert(\"".$msg."\");</script>";
}//end function
if (isset($_POST['send'])) {
if(strlen($_POST['nev'])>0 && strlen($_POST['email'])>0 && strlen($_POST['email2'])>0 && strlen($_POST['phone'])>0 ) {
if($_POST['email']==$_POST['email2']) {
if($period>0) {
$n=TRUE;
}else {
$msg="You can not departure earlier than you arrive! Plese check the dates.";
confirm($msg);
}} else {
$msg="The two email fields are not identical; enter your email again and confirm it." ;
confirm($msg);
}} else {
$n=FALSE;
$msg="Please fill all fields marked as * !";
confirm($msg);
}
if ($n) {
foreach($_POST as $key => $post)
{
if(!Empty($post))
{
$mail .= $key . "=" . $post . "\n";
}
}
if($_SERVER['SERVER_NAME'] == 'www.balatonhostel.hu')
{
mail($nekunk,"New reservation",$mail,"X-FW-MailID: " . $freewebxmail);
header('Location: koszonetenglish.html');
exit(); }
}
}
$page_title="Hullam Hostel";
include('./ujheader.inc');?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"><br>
<div style="margin-left: 40px;">
<p>To send a booking request to us, please fill in this form. We'll
send the confirmation of your reservation to your email address within 24
hours. </p>
<p>Fields with * are all required.<br>
</p>
</div>
<div style="text-align: center;"><br>
<br>
<div style="text-align: left; margin-left: 40px;">
<p>Name of the contact person* :
<input type="text" name="nev" value="<?php if (isset($_POST['nev'])) echo $_POST['nev'];?>"/> <br>
<br>
E-mail address for the confirmation *:
<input type="text"
name="email" value="<?php if (isset($_POST['email'])) echo $_POST['email'];?>"/> <br>
<br>
Retype e-mail address *:
<input type="text"
name="email2" value="<?php if (isset($_POST['email2'])) echo $_POST['email2'];?>"/><br>
<br>
Phone (including country code) *:
<input type="text" name="phone" value="<?php if (isset($_POST['phone'])) echo $_POST['nev'];?>"/><br>
<br>
Address of the contact person: country:
<input type="text" name="orszag" value="<?php if (isset($_POST['orszag'])) echo $_POST['orszag'];?>"/> city: <input name="varos" value="<?php if (isset($_POST['varos'])) echo $_POST['varos'];?>"/> <br>
<br>
Number of guests :
<input type="text" size="1" name="letszam" value="<?php if (isset($_POST['letszam'])) echo $_POST['letszam'];?>"/> persons <br>
<br>
Room type:
<select name="szobatipus">
<option>single room </option>
<option>single room ensuited</option>
<option>double room</option>
<option>double room ensuited</option>
<option>triple room</option>
<option>triple room ensuited</option>
<option>quad ensuited</option>
<option>4 bedded mix dorm</option>
<option>4 bedded female dorm</option>
<option>4 bedded male dorm</option>
<option>6 bedded mix dorm</option>
</select>
number of rooms :
<select name="szobak szama">
<option>0</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
<option>9</option>
</select>
extra beds:
<select name="potagyak szama">
<option>0</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option></option>
</select>
<br>
<br>
Date of arrival:
<select name="erkezes_honap"> <?php if (isset ($_GET['Month'])) { $select = $_GET['Month'] ;}
else {$select = Date('M') ; }?> <option value="Jan" <?php if($select == "Jan"){ echo 'selected="selected"';} ?> />Jan</option>
<option value="Feb" <?php if($select == "Feb"){ echo 'selected="selected"';} ?> />Feb</option>
<option value="Mar" <?php if($select == "Mar"){ echo 'selected="selected"';} ?> />Mar</option>
<option value="Apr" <?php if($select == "Apr"){ echo 'selected="selected"';} ?> />Apr</option>
<option value="May" <?php if($select == "May"){ echo 'selected="selected"';} ?> />May</option>
<option value="Jun" <?php if($select == "Jun"){ echo 'selected="selected"';} ?> />Jun</option>
<option value="Jul" <?php if($select == "Jul"){ echo 'selected="selected"';} ?> />Jul</option>
<option value="Aug" <?php if($select == "Aug"){ echo 'selected="selected"';} ?> />Aug</option>
<option value="Sep" <?php if($select == "Sep"){ echo 'selected="selected"';} ?> />Sep</option>
<option value="Oct" <?php if($select == "Oct"){ echo 'selected="selected"';} ?> />Oct</option>
<option value="Nov" <?php if($select == "Nov"){ echo 'selected="selected"';} ?> />Nov</option>
<option value="Dec" <?php if($select == "Dec"){ echo 'selected="selected"';} ?> />Dec</option></select>
<select name="erkezes_nap"><?php if (isset ($_GET['Day'])) {
$select = $_GET['Day'] ;
}
else {
$select = Date('d') ;
}
for ($i=1; $i<=31;$i ++){
$option .= "<option value=\"" . $i . "\"" ;
if ($select == $i) {
$option .= " selected=\"selected\""; }
$option .= ">" . $i . "</option>" ;
}
echo $option ;?> </select>
<select name="erkezes_ev"><?php if (isset ($_GET['Year'])) {
$selecterkev = $_GET['Year'] ;
}
else {
$selecterkev = Date('Y') ;
}
for ($year=2007; $year<=2009;$year ++){
$optionerkev .= "<option value=\"" . $year . "\"" ;
if ($selecterkev == $year) {
$optionerkev .= " selected=\"selected\"";
}
$optionerkev .= ">" . $year . "</option>" ;
}
echo $optionerkev ;?> </select>
</p>
<p> Number of nights:
<input size="1"
name="ejszakak szama" value="<?php if (isset($_POST['ejszakak szama'])) echo $_POST['ejszakak szama']; ?>"/>
<br>
<br>
Date of departure:
<select name="tavozas_honap"><?php if (isset ($_GET['Month'])) { $select = $_GET['Month'] ;}else {
$select = Date('M') ; } ?> <option value="Jan" <?php if($select == "Jan"){ echo 'selected="selected"';} ?> />Jan</option>
<option value="Feb" <?php if($select == "Feb"){ echo 'selected="selected"';} ?> />Feb</option>
<option value="Mar" <?php if($select == "Mar"){ echo 'selected="selected"';} ?> />Mar</option>
<option value="Apr" <?php if($select == "Apr"){ echo 'selected="selected"';} ?> />Apr</option>
<option value="May" <?php if($select == "May"){ echo 'selected="selected"';} ?> />May</option>
<option value="Jun" <?php if($select == "Jun"){ echo 'selected="selected"';} ?> />Jun</option>
<option value="Jul" <?php if($select == "Jul"){ echo 'selected="selected"';} ?> />Jul</option>
<option value="Aug" <?php if($select == "Aug"){ echo 'selected="selected"';} ?> />Aug</option>
<option value="Sep" <?php if($select == "Sep"){ echo 'selected="selected"';} ?> />Sep</option>
<option value="Oct" <?php if($select == "Oct"){ echo 'selected="selected"';} ?> />Oct</option>
<option value="Nov" <?php if($select == "Nov"){ echo 'selected="selected"';} ?> />Nov</option>
<option value="Dec" <?php if($select == "Dec"){ echo 'selected="selected"';} ?> />Dec</option>
</select>
<select name="tavozas_nap"><?php if (isset ($_GET['Day'])) {
$selecttavnap = $_GET['Day'] ;
}
else {
$selecttavnap = Date('d') ;
}
for ($j=1; $j<=31;$j ++){
$optiontavnap .= "<option value=\"" . $j . "\"" ;
if ($selecttavnap == $j) {
$optiontavnap .= " selected=\"selected\""; }
$optiontavnap .= ">" . $j . "</option>" ;
}
echo $optiontavnap ; ?></select>
<select name="tavozas_ev"><?php if (isset ($_GET['Year'])) {
$selecttavev = $_GET['Year'] ;
}
else {
$selecttavev = Date('Y') ;
}
for ($year=2007; $year<=2009;$year ++){
$optiontavev .= "<option value=\"" . $year . "\"" ;
if ($selecttavev == $year) {
$optiontavev .= " selected=\"selected\"";
}
$optiontavev .= ">" . $year . "</option>" ;
}
echo $optiontavev ; ?> </select>
<br>
</p>
<p><br>
Comments and requests:<br>
<textarea cols="20" rows="5"
name="uzenet"></textarea>
<br>
</p>
<div style="text-align: left;"> <br>
</div>
<div style="text-align: left;"><br>
</div>
<br>
<br>
<center> <input name="send"
value="SEND" type="submit"> </center>
<br>
<br>
</div>
</div>
</form>
Re: Hibaüzenet: Warning: Cannot send session...
lehet nemlátom át rendesen a problémád, de talánm próbáld meg, hogy az elejére beírod, hogy ob_start();
bővebben: http://hu.php.net/manual/hu/function.ob-start.php
KÖSZI
tuneti kezeles?!