Redirect page after an e-mail form

1

I am making a form that needs to arrive in my email but when someone clicks submit it is redirected to a thank you page. Thankful.

    
asked by anonymous 18.08.2015 / 01:29

1 answer

1

Create the redirection.php page - which will be the page that will check the form data and redirect the user to the thank you page - and write the following code:

<?php    
    if (isset($_POST['submicao']))
    {   
       <!-- faça a validação dos dados submetidos !-->

       header('Location: http://seusite/agradecimento.php');       
    }
?>

On your form page, make an include of the redirect page shortly after submitting the form

<html>
<head>
    <!-- Código do header !-->
</head>

<body>

    <form>
        <!-- Seus labels, etc. do formulario !-->

        <!-- Página de redirecionamento -->
        <?php include "include/redirecionamento.php"; ?>

    </form>
</body>
</html>

Or you can also use the following javascript code inside the <form>

<form onsubmit="window.location.href='redirecionamento.php';">

In this case, you would not need to "include".

                  

<body>

    <form onsubmit="window.location.href='redirecionamento.php';">>
        <!-- Seus labels, etc. do formulario !-->
    </form >
</body>
</html>
    
18.08.2015 / 01:35