php form processing - header problem

Discussion in 'PHP' started by red-head-mommie, Jul 15, 2008.

  1. #1
    Help! I built a form and a page to process it. It worked yesterday, but I needed to add some extra stuff and now I'm missing something. I get this error message:

    "Warning: Cannot modify header information - headers already sent by (output started at /home/artwo6/public_html/secretartists/process.php:2) in /home/artwo6/public_html/secretartists/process.php on line 11"

    Here is my code: (sorry, not sure how to add it like everyone else does)

     
    red-head-mommie, Jul 15, 2008 IP
  2. mbreezy

    mbreezy Active Member

    Messages:
    135
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    55
    #2
    Hmmm, I don't see anything very obvious. Normally I get that if I print/echo something BEFORE the header() line, but that doesn't appear to be the case unless even I am over looking something.
     
    mbreezy, Jul 15, 2008 IP
  3. BDazzler

    BDazzler Peon

    Messages:
    215
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Are you by any chance, including the page in another, which has a print/echo?

    Also, is it possible that you're getting a SQL error before your header error? If you are, then that's your "print/echo".
     
    BDazzler, Jul 15, 2008 IP
  4. php-lover

    php-lover Active Member

    Messages:
    261
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    58
    #4
    I think you have to make sure that the following line below are correct. If it's not correct it will output an error to the browser and it cause the header to display that error.

    Make sure you connect to database and also make sure your database name is correct.

    $db=mysql_connect("localhost", "LOGIN", "PASSWORD") or die("Could not connect to localhost.");
    mysql_select_db("artwo6_secretartists08", $db) or die("Could not find visitors.");
     
    php-lover, Jul 15, 2008 IP
  5. Danltn

    Danltn Well-Known Member

    Messages:
    679
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    120
    #5
    I can't see any obviously errors either except the above ones, it won't be DB errors as that would stop execution, try either using the output buffering functions or headers_sent($a, $b);
     
    Danltn, Jul 15, 2008 IP
  6. red-head-mommie

    red-head-mommie Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    The database name and login are correct. I will check the print/echo - that could be the problem.
     
    red-head-mommie, Jul 16, 2008 IP
  7. sastro

    sastro Well-Known Member

    Messages:
    214
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    105
    #7
    Change "Could not connect to localhost."; to mysql_error() and you will see the error
     
    sastro, Jul 16, 2008 IP