Quick PHP question

Discussion in 'PHP' started by thefreebielife, Jun 6, 2009.

  1. #1
            if(mail($myemail, $subject, $message, $header))
            {
                $status = "Thank you for contacting us, we will be in touch shortly<br><br>";
            }
            else
            {
                $status = "There was a problem sending your feedback, please try again later.<br><br>";
            }
     
        }
        else
        {
            $status .= "<br>Please press <u>back</u> on your browser to resubmit.<br><br>";
        }
    }    
     
    PHP:
    This is my current code... how do i get it to redirect to another page after the form is submitted? (This is for a contact form)

    Thanks
     
    thefreebielife, Jun 6, 2009 IP
  2. osmasters

    osmasters Well-Known Member

    Messages:
    453
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    100
    #2
    <script type='text/javascript'>
    window.location = 'newpage.php'
    </script>
    Just write above code after displaying status.
     
    osmasters, Jun 6, 2009 IP
  3. thefreebielife

    thefreebielife Peon

    Messages:
    1,202
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #3
    The JS messes up the whole page for me
     
    thefreebielife, Jun 6, 2009 IP
  4. umanohone

    umanohone Peon

    Messages:
    56
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Replace:
    With this:
     
    umanohone, Jun 6, 2009 IP
  5. snowLee

    snowLee Member

    Messages:
    55
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #5
    
    <?php
    if(isset($_POST['submit']))
    {
     //put varibles in $_POST
     if($errors=='')
     {
    		$to = "your_email@email.com";
    		$from_email =  "$name";
    		$head = "From my contact page";
    		$msg  = "\n Name: $name \n  Email: $email \n\n MESSAGE: \n $messsage\n ";
    		mail($to, $head, $msg, "From: $from_email");
      }
      ?>
    <div align="center"><p>Thank you for your message. Go to the home page<a href="index.php"</p> </div>
    <?php
    }
    ?>
    
    PHP:
     
    snowLee, Jun 6, 2009 IP