3
Can someone please help me?
I saw this on the net and tried to take advantage, however in my email I receive the fields "Name:" and "Email:" but they are completely empty, but when sending I send with the fields filled!
index.html
<form method="POST" action="newsletter.php">
<li>
<input type="text" class="text" value="Nome">
</li>
<li>
<input type="text" class="text" value="Email">
</li>
<input type="submit" value="submit">
</form>
php newsletter.
# RESULT PAGE
$location = "";
## FORM VALUES ##
# SENDER - WE ALSO USE THE RECIPIENT AS SENDER
# DON'T INCLUDE UNFILTERED USER INPUT IN THE MAIL HEADER!
# SEE ALSO: How to protect a php Email Form using php mail or mb_send_mail against Mail Header Injection
$sender = $recipient;
# MAIL BODY
$body = "Name: ".$_REQUEST['Nome']." \n";
$body = "Email: ".$_REQUEST['Email']." \n";
# add more fields here if required
## SEND MESSGAE ##
mail($subject, $body, "From: $sender" ) or die ("O email não pode ser enviado.");
## SHOW RESULT PAGE ##
header( "Location: $location" );
?>
Thank you
I already changed, javascript was part of another approach, nothing to be :)
– Dmgp
If the method is always POST I think it’s best to exchange $_REQUEST for $_POST.
– Bacco