contact.php Internal Server Error

Discussion in 'PHP' started by Terpentin01, Apr 11, 2010.

  1. #1
    <html>
    <body>

    <?php
    if (isset($_REQUEST['email']))
    //if "email" is filled out, send email
    {
    //send email
    $name = $_REQUEST['name'];
    $email = $_REQUEST['email'] ;
    $phone = $_REQUEST['phone'];
    $location = $_REQUEST['location'];
    $foundus = $_REQUEST['foundus'];
    $questions = $_REQUEST['questions'];
    mail( "steinfeldtt@yahoo.com", "Quote: $name - from $name",
    "Questions: $questions\nEmail: $email\nPhone: $phone\nName: $name\nLocation: $location\nHow I found you: $foundus" );
    echo "Thank you for using our mail form. Click <a href='index.html'>here</a> to go back.";
    }
    else
    //if "email" is not filled out, go back to the form page
    {
    header( 'Location: javascript: history.go(-1)' ) ;
    }
    ?>

    </body>
    </html>


    hmmmmmmmm.....it works together with http://acarniball.com/contact.html

    Thanks!:confused::confused::confused:
     
    Terpentin01, Apr 11, 2010 IP
  2. lukeg32

    lukeg32 Peon

    Messages:
    645
    Likes Received:
    19
    Best Answers:
    1
    Trophy Points:
    0
    #2
    Your syntax looks ok.

    However, the above will NOT work - you have already outputted (<html><body>) so you cannot use the header function.
     
    lukeg32, Apr 12, 2010 IP
  3. nimonogi

    nimonogi Active Member

    Messages:
    398
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    80
    #3
    Try this way:
    
    else
    //if "email" is not filled out, go back to the form page
    {
    echo 'Email is not filled out, go back to the form page: <a href="#" onclick="javacript:history.go(-1);">Go Back</a>';
    }
    
    Code (markup):
     
    nimonogi, Apr 12, 2010 IP