Professional Web Applications Themes

Simple problem I think!!!!! - PHP Development

I have the following code: if(mail($to,$subject,$body,$from)) { //go to Spoono Header ("Location: http://www.spoono.com/"); - Line 21 is here. } else { //else go to Yahoo Header ("Location: http://www./"); } Easy Eh!!! NOOOOOOOOOOOOOOOOOOOO. I get this error ALLLLL the time, and can't work out why. Any Ideas? Warning: Cannot modify header information - headers already sent by (output started at /home/www/listerradio.com/mail.php:12) in /home/www/listerradio.com/mail.php on line 21 Thanks Gavin....

  1. #1

    Default Simple problem I think!!!!!

    I have the following code:

    if(mail($to,$subject,$body,$from))
    {
    //go to Spoono
    Header ("Location: http://www.spoono.com/"); - Line 21 is here.

    }
    else
    {
    //else go to Yahoo
    Header ("Location: http://www./");
    }

    Easy Eh!!!

    NOOOOOOOOOOOOOOOOOOOO.

    I get this error ALLLLL the time, and can't work out why. Any Ideas?

    Warning: Cannot modify header information - headers already sent by (output
    started at /home/www/listerradio.com/mail.php:12) in
    /home/www/listerradio.com/mail.php on line 21

    Thanks

    Gavin.


    Gavin Guest

  2. #2

    Default Re: Simple problem I think!!!!!

    Gavin wrote:
    > I get this error ALLLLL the time, and can't work out why. Any Ideas?
    >
    > Warning: Cannot modify header information - headers already sent by
    > (output started at /home/www/listerradio.com/mail.php:12) in
    > /home/www/listerradio.com/mail.php on line 21
    >
    This is the most frequently asked question of them all.

    To quote the manual ([url]http://www.php.net/header):[/url]

    "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."


    JW



    Janwillem Borleffs Guest

  3. #3

    Default Re: Simple problem I think!!!!!

    Please send your entire code so we can have a look!

    "Gavin" <ab.com> wrote in message
    news:WAE_c.91$6m1.61newsfe5-gui.ntli.net...
    > I have the following code:
    >
    > if(mail($to,$subject,$body,$from))
    > {
    > //go to Spoono
    > Header ("Location: http://www.spoono.com/"); - Line 21 is here.
    >
    > }
    > else
    > {
    > //else go to Yahoo
    > Header ("Location: http://www./");
    > }
    >
    > Easy Eh!!!
    >
    > NOOOOOOOOOOOOOOOOOOOO.
    >
    > I get this error ALLLLL the time, and can't work out why. Any Ideas?
    >
    > Warning: Cannot modify header information - headers already sent by
    (output
    > started at /home/www/listerradio.com/mail.php:12) in
    > /home/www/listerradio.com/mail.php on line 21
    >
    > Thanks
    >
    > Gavin.
    >
    >

    Ike Guest

  4. #4

    Default Re: Simple problem I think!!!!!

    Ike wrote:
    > Please send your entire code so we can have a look!
    >
    Not necessary, see my reply. A simple case of RTFM.


    JW



    Janwillem Borleffs Guest

  5. #5

    Default Re: Simple problem I think!!!!!


    On 5-Sep-2004, "Gavin" <ab.com> wrote:
    > I have the following code:
    >
    > if(mail($to,$subject,$body,$from))
    > {
    > //go to Spoono
    > Header ("Location: http://www.spoono.com/"); - Line 21 is here.
    >
    > }
    > else
    > {
    > //else go to Yahoo
    > Header ("Location: http://www./");
    > }
    >
    > Easy Eh!!!
    >
    > NOOOOOOOOOOOOOOOOOOOO.
    >
    > I get this error ALLLLL the time, and can't work out why. Any Ideas?
    >
    > Warning: Cannot modify header information - headers already sent by
    > (output
    > started at /home/www/listerradio.com/mail.php:12) in
    > /home/www/listerradio.com/mail.php on line 21
    The problem is mail() is generating some output which prevents header() from
    working properly. Put an in front of the mail function call to suppress
    mail()'s output:

    if (mail(...)

    --
    Tom Thackrey
    [url]www.creative-light.com[/url]
    tom (at) creative (dash) light (dot) com
    do NOT send email to [email]jamesbutlerwillglen.net[/email] (it's reserved for spammers)
    Tom Thackrey Guest

  6. #6

    Default Re: Simple problem I think!!!!!

    On Sun, 05 Sep 2004 13:33:42 GMT, "Gavin" <ab.com> wrote:
    >output started at /home/www/listerradio.com/mail.php:12
    Look on line 12.

    --
    Andy Hassall / <andyandyh.co.uk> / <http://www.andyh.co.uk>
    <http://www.andyhsoftware.co.uk/space> Space: disk usage ysis tool
    Andy Hassall Guest

  7. #7

    Default Re: Simple problem I think!!!!!

    I knew it had to be simple. Thanks, all sorted now.

    Gav.

    "Janwillem Borleffs" <jwjwscripts.com> wrote in message
    news:413b1995$0$7130$abc4f4c3news.euronet.nl...
    > Gavin wrote:
    > > I get this error ALLLLL the time, and can't work out why. Any Ideas?
    > >
    > > Warning: Cannot modify header information - headers already sent by
    > > (output started at /home/www/listerradio.com/mail.php:12) in
    > > /home/www/listerradio.com/mail.php on line 21
    > >
    >
    > This is the most frequently asked question of them all.
    >
    > To quote the manual ([url]http://www.php.net/header):[/url]
    >
    > "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."
    >
    >
    > JW
    >
    >
    >

    Gavin Guest

  8. #8

    Default Re: Simple problem I think!!!!!

    All you have to do is use output buffering. simply call
    ob_start()
    before anything else runs.

    Tom Thackrey wrote:
    > On 5-Sep-2004, "Gavin" <ab.com> wrote:
    >
    >
    >>I have the following code:
    >>
    >>if(mail($to,$subject,$body,$from))
    >>{
    >> //go to Spoono
    >> Header ("Location: http://www.spoono.com/"); - Line 21 is here.
    >>
    >>}
    >>else
    >>{
    >> //else go to Yahoo
    >> Header ("Location: http://www./");
    >>}
    >>
    >>Easy Eh!!!
    >>
    >>NOOOOOOOOOOOOOOOOOOOO.
    >>
    >>I get this error ALLLLL the time, and can't work out why. Any Ideas?
    >>
    >>Warning: Cannot modify header information - headers already sent by
    >>(output
    >>started at /home/www/listerradio.com/mail.php:12) in
    >>/home/www/listerradio.com/mail.php on line 21
    >
    >
    > The problem is mail() is generating some output which prevents header() from
    > working properly. Put an in front of the mail function call to suppress
    > mail()'s output:
    >
    > if (mail(...)
    >
    morfy50 Guest

Similar Threads

  1. XML::Simple problem
    By Bill McCormick in forum PERL Modules
    Replies: 7
    Last Post: February 18th, 02:00 AM
  2. LWP::Simple get() problem
    By Hon Guin Lee - Web Producer - SMI Marketing in forum PERL Modules
    Replies: 0
    Last Post: September 26th, 01:52 PM
  3. a very simple problem!
    By janet in forum ASP
    Replies: 9
    Last Post: August 20th, 05:37 PM
  4. Best Way To Do This --- Simple Problem
    By Ron in forum ASP.NET General
    Replies: 1
    Last Post: August 12th, 04:34 AM
  5. A simple problem with a really simple form
    By Simon Harvey in forum Macromedia Dreamweaver
    Replies: 0
    Last Post: July 13th, 04:34 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139