Simple problem I think!!!!!

Ask a Question related to PHP Development, Design and Development.

  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.yahoo.com/");
    }

    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. Similar Questions and Discussions

    1. XML::Simple problem
      A simple test script: #! /usr/bin/perl -w use DBI; use XML::Simple; use Data::Dumper; use strict; my $xmlconfig = XMLin(); print...
    2. LWP::Simple get() problem
      Hi, I am having problems with the following code, in which the get() function from the LWP::Simple is not retrieving any of the contents of the...
    3. a very simple problem!
      hi ... When i click to the submit button, i want to insert value from the a text box to the mysql db. But when i enter text in the text box...
    4. Best Way To Do This --- Simple Problem
      I need to list a few rows of data in text format, for example: ID: 5442224 ID: 5311255 ID: 3536463 The values will be bound to either...
    5. A simple problem with a really simple form
      Hi there, I'm having a problem with designing a very small form in Dreamweaver. Its just a login form with username and password textfields - the...
  3. #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

  4. #3

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

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

    "Gavin" <a@b.com> wrote in message
    news:WAE_c.91$6m1.61@newsfe5-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.yahoo.com/");
    > }
    >
    > 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

  5. #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

  6. #5

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


    On 5-Sep-2004, "Gavin" <a@b.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.yahoo.com/");
    > }
    >
    > 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]jamesbutler@willglen.net[/email] (it's reserved for spammers)
    Tom Thackrey Guest

  7. #6

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

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

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

  8. #7

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

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

    Gav.

    "Janwillem Borleffs" <jw@jwscripts.com> wrote in message
    news:413b1995$0$7130$abc4f4c3@news.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

  9. #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" <a@b.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.yahoo.com/");
    >>}
    >>
    >>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

Posting Permissions

  • You may not post new threads
  • You may 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