Cannot Modify Header

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
brmcdani
Forum Newbie
Posts: 17
Joined: Wed Sep 02, 2009 8:21 pm

Cannot Modify Header

Post by brmcdani »

I am getting the following error message:

Cannot modify header information - headers already sent by (output started at /home/content/s/a/g/sagates/html/contact.php:1) in /home/content/s/a/g/sagates/html/contact.php on line 17


Here is my code:

Code: Select all

<?php
ob_start();
$name = $_REQUEST['name'];
$phone = $_REQUEST['phone'];
$email = $_REQUEST['email'];
$pref = $_REQUEST['pref'];
$type = $_REQUEST['type'];
$kind = $_REQUEST['kind'];
$message = $_REQUEST['message'];
$body = "Name: $name
\nPhone Number: $phone
\nEmail: $email
\nContact Preference: $pref
\nJob Type: $type
\nInterested In: $kind
\nDescription: $message \n\n";
mail( "brett.mcdaniel@ttu.edu", "Contact Request", $body);header("Location: thankyou.htm");
?>
Can someone please help me out??? Thanks
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Cannot Modify Header

Post by requinix »

Make sure there's nothing before the opening <?php and that you're saving your files as ASCII/ANSI and not UTF-8 or -16.
User avatar
daedalus__
DevNet Resident
Posts: 1925
Joined: Thu Feb 09, 2006 4:52 pm

Re: Cannot Modify Header

Post by daedalus__ »

why are you using output buffering?
Post Reply