Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Sep 2005
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    mail() and header() clashing

    Hi

    I am using 2 headers on a page.

    mail("$recipient", "$subject", "$forminfo", "From: $contactEmail\r\nReply-to:$contactEmail");

    header("Location: http://www.c-digital.co.uk/pertemps/thanks.php");

    Is that allowed?


    I keep getting an error message:
    Warning: Cannot modify header information - headers already sent by (output started at /jobs/jobs_card/jobs_card_mail.php:1) in jobs/jobs_card/preview_jobs.php on line 45

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    Comment out your mail function.
    Same error?
    Solution is simple, you have previous output to the browser. Use output_buffering to prevent, but assuming that using header for a location change, you don't need to display output at all. Just remove whatever output is currently there.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #3
    Senior Coder NancyJ's Avatar
    Join Date
    Feb 2005
    Location
    Bradford, UK
    Posts
    3,172
    Thanks
    19
    Thanked 65 Times in 64 Posts
    I doubt it has anything to do with your mail() function. Either you have already output html on line45 or you have opened and closed your php tags leaving white space in between


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •