12, October 2008

Output error while sending headers - webmaster forum

 
Webdigity webmaster forums
This forum shares its ad revenue with its members!
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  PhP
Topic: Output error while sending headers
« previous next »
Pages: [1] Print

Author Topic: Output error while sending headers  (Read 1279 times)
Atari ST fan
*
Posts: 7
48 credits
Members referred : 0


« on: Nov 26, 2006, 11:48:42 PM »

I am using Simple form mail ver. 1.11.
The form is at www.bushbuckadventures.com/booking.html Visit through proxy
It produces this error message:
"Warning: Cannot modify header information - headers already sent by (output started at /home/content/b/u/s/bushbuck/html/booking2.php:2) in /home/content/b/u/s/bushbuck/html/booking2.php on line 20"

Line 20 appears to be this: header("Location: ".$goto_after_mail);

It's supposed to direct it to thankyou.html

Otherwise the script works - it sends the right information to my email address.

Please advise. Thanks.
-s
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 8116
41653 credits
Members referred : 3



Re: simple mail script
« Reply #1 on: Nov 26, 2006, 11:56:25 PM »

This error is because you output information, and then send headers.

Headers should be send before output.

Check the documentation here Visit through proxy

Trial and Error my two best teachers Cool
Join us @ facebook Visit through proxy

Last blog : Free Unlimited Bandwith and disk space to good to be true?
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 8116
41653 credits
Members referred : 3



« Reply #2 on: Nov 27, 2006, 12:15:33 AM »

The problem is before that line.

There is something printed before that.

That should be removed.

Trial and Error my two best teachers Cool
Join us @ facebook Visit through proxy

Last blog : Free Unlimited Bandwith and disk space to good to be true?
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6349
38918 credits
Members referred : 374


It's time to use PHP5!


« Reply #3 on: Nov 27, 2006, 12:28:30 AM »

Hey Nick you answered this thread already thanks! Wink


Last blog : Upload images for usage in TinyMCE
Atari ST fan
*
Posts: 7
48 credits
Members referred : 0


« Reply #4 on: Nov 27, 2006, 12:31:08 AM »

I hope we are both talking about the same script! It is posted here:
http://www.finalwebsites.com/snippets.php Visit through proxy
The only change I made was to put my email address instead of you@yourmail.com and the name of the goto page which is thankyou.html
I don't know what change I should make to stop the error message.
-s
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 8116
41653 credits
Members referred : 3



« Reply #5 on: Nov 27, 2006, 12:49:28 AM »

The script doesn't really matters as the error is this.

There is something printed in the browser before the error.

That should be removed.

Trial and Error my two best teachers Cool
Join us @ facebook Visit through proxy

Last blog : Free Unlimited Bandwith and disk space to good to be true?
Atari ST fan
*
Posts: 7
48 credits
Members referred : 0


« Reply #6 on: Nov 27, 2006, 01:17:46 AM »

Sorry, I have no idea what you mean!
-s
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6349
38918 credits
Members referred : 374


It's time to use PHP5!


« Reply #7 on: Nov 27, 2006, 10:19:05 AM »

this is the part from the manual where this is about:

Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP. It is a very common error to read code with include(), or require(), functions, or another file access function, and have spaces or empty lines that are output before header() is called. The same problem exists when using a single PHP/HTML file.

Code:
<html>
<?php
/* This will give an error. Note the output
 * above, which is before the header() call */
header('Location: http://www.example.com/');
?>


Last blog : Upload images for usage in TinyMCE
Atari ST fan
*
Posts: 7
48 credits
Members referred : 0


« Reply #8 on: Nov 28, 2006, 04:24:55 AM »

So are you saying that the way I am calling the php script from my html form page is incorrect? Specifically that this line:
<form action="booking2.php" method="post" name="booking form">
is incorrect or in the wrong place?
-s
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6349
38918 credits
Members referred : 374


It's time to use PHP5!


« Reply #9 on: Nov 28, 2006, 08:16:26 AM »

it's about sending html ouput before the calling the function "header" (don't understand why the last example is not clrear)


Last blog : Upload images for usage in TinyMCE
Atari ST fan
*
Posts: 7
48 credits
Members referred : 0


« Reply #10 on: Nov 28, 2006, 09:00:43 AM »

Your last example was clear - it just doesn't relate to my situation - I don't have a single PHP/HTML file. I have an html page (booking.html) and a php file (booking2.php) that is called as the action for submitting the form. I don't see where I am sending html output before calling the function "header". What happens before the function "header" is called is that the mail is sent.
-s
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6349
38918 credits
Members referred : 374


It's time to use PHP5!


« Reply #11 on: Nov 28, 2006, 09:12:36 AM »

Your last example was clear - it just doesn't relate to my situation - I don't have a single PHP/HTML file. I have an html page (booking.html) and a php file (booking2.php) that is called as the action for submitting the form. I don't see where I am sending html output before calling the function "header". What happens before the function "header" is called is that the mail is sent.
-s

do you use echo before the header? (its also html output)


Last blog : Upload images for usage in TinyMCE
Atari ST fan
*
Posts: 7
48 credits
Members referred : 0


« Reply #12 on: Nov 29, 2006, 07:36:39 AM »

I'm using the script as posted here:
<http://www.finalwebsites.com/snippets.php?id=3>
There is no "echo".
I'm using the form as posted here:
<www.bushbuckadventures.com/booking.html>
There is no "echo" in the form.
-s
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6349
38918 credits
Members referred : 374


It's time to use PHP5!


« Reply #13 on: Nov 29, 2006, 09:27:29 AM »

post the code until row 20 from this file booking2.php


Last blog : Upload images for usage in TinyMCE
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6349
38918 credits
Members referred : 374


It's time to use PHP5!


« Reply #14 on: Nov 29, 2006, 09:29:10 AM »

I think there is some whitespace (which is out too!)


Last blog : Upload images for usage in TinyMCE
Atari ST fan
*
Posts: 7
48 credits
Members referred : 0


« Reply #15 on: Dec 01, 2006, 06:40:51 AM »

Thank you all for your help - I found an empty line above the "<?php" - it's fixed now and all working well.
-s
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=4948
Tags : php html browsers email Bookmark this thread : Digg Del.icio.us Dzone more....

Topic sponsors:
Get a permanent link here for $1.99!


Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  PhP
Topic: Output error while sending headers
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
Oct 12, 2008, 04:46:28 AM





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!


Forum Statistics
Total Posts: 36.906
Total Topics: 7.558
Total Members: 4.150
Tutorials : 56
Resources : 143
Designs : 220
Latest Member: neli67

16 Guests, 3 Users online :

13 users online today:



Readers

Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2008 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.