richrock Posted January 22, 2009 Share Posted January 22, 2009 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? Link to comment https://forums.phpfreaks.com/topic/141932-solved-headers-already-sent-wierd-issue-with-localremote/ Share on other sites More sharing options...
landavia Posted January 22, 2009 Share Posted January 22, 2009 plz type line 8-10 instruments.php and line 700-705 functions.php Link to comment https://forums.phpfreaks.com/topic/141932-solved-headers-already-sent-wierd-issue-with-localremote/#findComment-743159 Share on other sites More sharing options...
richrock Posted January 22, 2009 Author Share Posted January 22, 2009 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; } Link to comment https://forums.phpfreaks.com/topic/141932-solved-headers-already-sent-wierd-issue-with-localremote/#findComment-743207 Share on other sites More sharing options...
landavia Posted January 22, 2009 Share Posted January 22, 2009 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() Link to comment https://forums.phpfreaks.com/topic/141932-solved-headers-already-sent-wierd-issue-with-localremote/#findComment-743214 Share on other sites More sharing options...
richrock Posted January 22, 2009 Author Share Posted January 22, 2009 Got it. I put the connect, lang etc and call to the final function above this and it's sorted on both local and remote. Strange how it did work on my local server though.... :-\ Link to comment https://forums.phpfreaks.com/topic/141932-solved-headers-already-sent-wierd-issue-with-localremote/#findComment-743227 Share on other sites More sharing options...
landavia Posted January 23, 2009 Share Posted January 23, 2009 perhaps.. in htconfig (server config).. something uncheck/deactive? Link to comment https://forums.phpfreaks.com/topic/141932-solved-headers-already-sent-wierd-issue-with-localremote/#findComment-743909 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.