PDA

View Full Version : Help with this Header Warning


2bz2p
07-25-2008, 12:12 PM
Hi,

This is the warning I am getting:



Warning: Cannot modify header information - headers already sent by (output started at /home/*******/vpilot/vpilot/skins/default/index.tmp.php:118) in /home/******/vpilot/vpilot/source/admin/manage_airline_details.php on line 24


Ill post the code once I find which one it is, but theres what it looks like for all my headers:

header ('location:'.$cfg['domain'].'index.php?action=details&change=edited');
exit;

Thanks
2b

davidj
07-26-2008, 09:56 PM
do you have an echo above the <html tag

2bz2p
07-27-2008, 12:55 AM
Ill Check but I dont Think So

2bz2p
07-27-2008, 04:17 PM
You know now that I think about it, everything is pretty much functions and I hadnt seperated the php above the html tag and the php the should be with in the tag see example

This is my airline details function which falls into the main content DIV on the index.tmp.php file which is the layout file.

<html>
<body>
SO right here is like the header div and navigation div and what not

Both blocks are 1 function

This block should be above the HTML Tag

function airline_details() {
global $database_conn_abrv,$conn_abrv,$cfg,$row_al;

if(isset($_POST['save']))
{
$airline_name = addslashes(trim($_POST['name']));
$airline_website = addslashes(trim($_POST['url']));
$airline_email = htmlentities($_POST['email']);
$welcome_message = htmlentities($_POST['welcome']);
$airline_pre = htmlentities($_POST['pre']);
$airline_tos = htmlentities($_POST['tos']);
mysql_select_db($database_conn_abrv, $conn_abrv);
$query_in = "UPDATE airline_details SET airline_name = '$airline_name', airline_website = '$airline_website', airline_email = '$airline_email', airline_tos = '$airline_tos', welcome_message = '$welcome_message', airline_pre = '$airline_pre' WHERE id = '1'";
$in = mysql_query($query_in, $conn_abrv) or die(mysql_error());
header( 'Location:'.$cfg['domain'].'index.php?action=details&change=updated');
exit;
}
?>


This block should be with in the html tags


<div id="main_content">
<h2>Airline Details</h2>

<?php $change= mysql_real_escape_string($_GET['change']);?>
<?php if ($change == 'updated') {
echo '<span class="green">Airline information was updated.</span>';
}?>

/* The form here */

</div><!-- End Main Content-->
<?php
return ;
}
?>


this would be where my footer div is
then
</body>
</html>


So could that be the issue the fact that the Header is with in the html tags and not out side them.

2bz2p
07-27-2008, 05:13 PM
Yep that is what it is.

I need to break up all my content functions into 2 parts _php and _html. Then create the switch to flip through each top portion of php and leave the html php where it belongs in the html tags

Thanks again DJ
2b

2bz2p
07-28-2008, 03:40 PM
I dont think it worked because when it went online I got the header errors again, I have found that on my localhost it runs different than on my server.

Any other thoughts would be greatly appreciated.
Thanks
2b

2bz2p
07-29-2008, 02:00 PM
Finnaly figured it out.


?>
blank line
blank line


Its seems you can not have extra lines after the last ?> on the page.

all squared away though
Thanks again
2b