Need Help! Php send mail

Discussion in 'PHP' started by Quietmenace, May 27, 2010.

  1. #1
    Hi friends,

    I am using form to email with the help of php. The code is fine but I want some changes to the result page. I am new to this so please help. Here is the truncated code.

    echo '<font style="font-family:Verdana, Arial; font-size:11px; color:#333333; font-weight:bold">Mail has been sent Successfully.<br /></font>';
    }
    else
        {
            echo '<font style="font-family:Verdana, Arial; font-size:11px; color:#F3363F; font-weight:bold">Wrong file format. Mail was not sent.</font>';
        }
    
    ?>
    Code (markup):
    I wanted that if the mail is send, ie. "Mail has been sent Successfully" then it should go to thankyou.html if not then to the form.html again.
     
    Quietmenace, May 27, 2010 IP
  2. dsignresponder

    dsignresponder Greenhorn

    Messages:
    81
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    18
    #2
    I think you'd like to redirect your visitors depending on the result of a form submission.... right?
    If it's that so, redirect in php can be done like :
    
    if ( CONDITION ) {
    header("Location: http://www.example.com/"); /* Redirect browser */
    
    /* Make sure that code below does not get executed when we redirect. */
    exit;
    }
    else {
    header("Location: http://www.something.com/"); /* Redirect browser */
    
    /* Make sure that code below does not get executed when we redirect. */
    exit;
    }
    
    PHP:
    NOTE : 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.
     
    dsignresponder, May 27, 2010 IP
  3. webria

    webria Peon

    Messages:
    43
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    If this question has not been answered, to meet your need, please let us know.
     
    webria, May 28, 2010 IP
  4. Quietmenace

    Quietmenace Peon

    Messages:
    64
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    That is also a good option but not what I wanted. :)
     
    Quietmenace, May 29, 2010 IP