Hello, I have an e-mail newsletter code and when I enter the wrong email address or give some error, I would like instead of redirecting to the registration.html page, it redirects to the previous page, how can I do this?
The PHP Code looks like this:
<?php
include("config.php");
$email = $_POST["e-mail"];
$opcao = $_POST["opcao"];
$codigo = md5($email);
if($email == ""){
echo "<script>alert('Por favor, digite um email válido.');";
echo "location.href='cadastro.html'</script>";
} [..]
I do not know if it can be done in JS or just in PHP itself.
Thank you all for trying to help.