Jump to content

[SOLVED] Headers already sent - wierd issue with local/remote


richrock

Recommended Posts

Hi all,

 

I've used header() in a few places for various scripts, and successfully too, but this time I'm really stumped.

 

I've got a redirect in a function (functions.php) like this :

 

header("Location:receipt_confirm.php?gen_rec=gen_rec&rec_num=".$rec_num."&userid=".$usrid."");

 

which is only conditional when the Finish button is pressed.  So on my form script (instruments.php) - I have a Save and Finish button, which runs a function, tagging on the header code above.

 

This works fine on the local test server.  No errors, nothing.  Yet on the remote server, I get this:

 

Warning: Cannot modify header information - headers already sent by (output started at /home/sites/testsite.com/public_html/administration/instruments.php:9) in /home/sites/testsite.com/public_html/administration/functions.php on line 702

 

 

I figured that instruments.php:9 means line 9, which is :

 

<?php require('lang.php'); ?>

 

and is only a straight php file, no html or anything else.  I did the whitespace check, as many sites recommend checking anyway.

 

Any ideas?

 

 

Here's instruments.php:

 

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<link href="form.css" rel="stylesheet" type="text/css" />

<title>instruments.php</title>

</head>

<body>

<link href="form.css" rel="stylesheet" type="text/css" />

<?php require('lang.php'); ?>

<?php require('connect.php'); ?>

<?php require('functions.php'); ?>

<?php include('index.php'); ?>

<div id="main-page">

 

 

and functions.php:

 

        if (($_POST['addfinal']) && (!$_POST['editInstr'])){

            header("Location:receipt_confirm.php?gen_rec=gen_rec&rec_num=".$rec_num."&userid=".$usrid."");

            exit;

        }

yap..

because of this

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="form.css" rel="stylesheet" type="text/css" />
<title>instruments.php</title>
</head>
<body>
<link href="form.css" rel="stylesheet" type="text/css" />

the header not work.. u should try to not place HTML before the header.. or using ob_start()

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.