I have a form that should send an email, I created a file called email.php to create this function.
?php
$nome = $_REQUEST['name'];
$fone = $_REQUEST['phone'];
$email = $_REQUEST['email'];
$para = "[email protected]";
$assunto = "Contato pelo site";
$url = $_SERVER['HTTP_REFERER'];
if ($url == "MEULINK/administracao.html") {
$curso = "Administração";
} elseif ($url == "MEULINK/ciencias-contabeis.html") {
$curso = "Ciências Contábeis";
} elseif ($url == "MEU LINK/landing-page/neurociencia.html") {
$curso = "Neurociência";
}
$corpo = "<html><b>Contato pelo site</b><br><br>
<b>Curso: </b> $curso<br>
<b>Nome: </b> $nome<br>
<b>Telefone: </b> $fone</br>
<b>Email: </b> $email </html>"
;
$header = "Content-Type: text/html; charset= utf-8";
$header .= "From: $email Reply-to: $email";
mail($para, $assunto, $corpo, $header);
header("location:$url?msg=enviado")
?>
In this case, the $ course only works for the first condition. If the link is /ciencias-contabeis.html it does not receive what's inside $ course