skip to Main Content

Hi guys I have the ff codes:

<?php $name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$formcontent="From: $name n Message: $message";
$recipient = "[email protected]";
$subject = "Chick SEO Contact Form: New Email from $name";
$mailheader = "From: $email rn";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo "Thank you!";
?>

Right now its only redirecting the page to a simple echo page with text "Thank you"

Is there anyway we can redirect the user to this URL https://recurpost.com/ once the form was submitted and the email was sent instead of sending it to echo?

2

Answers


  1. You need to use the Php header function. Instead of the echo, you can use the following:

    header("Location: https://recurpost.com/");
    

    The above code will include a "location" header in the Http response. This will cause the browser to redirect the user to the given url. See the documentation for the header function

    Login or Signup to reply.
  2. Try using

    <?php
      echo "
            <script>
                    window.location.replace('https://urdomain.org/successpage');
            </script>
        ";
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search