I've tried everything outlined in this tutorial.
But no matter what, when the checkbox script still produces an error message.
<?php
ini_set( display_errors, 1 );
error_reporting( E_ALL );
$email = $_POST['myEmail'];
$name = $_POST['myName'];
if (isset($_POST['news'])) {
$checkBoxValue = "yes";
} else {
$checkBoxValue = "no";
}
$to = "web@myemail.com";
$subject = "Add me to the Launch Day Notification List!";
$headers = "From:".$email;
$txt = "This person wishes to be added to the launch day notification list: $name\nDoes
this person wish to subscribe to the newsletter? $news";
mail($to,$subject,$headers,$txt);
echo "Thank you for your inquiry, you will be added to our launch day notification
list!";
?>
client-side code:
<form action="mail.php" method="post">
Name: <input type="text" name="myName" class="contactform" placeholder="name"required><br>
Email: <input type="text" name="myEmail" class="contactform" placeholder="you@youremail.com" required>
<p>Would you like to subscribe to our newsletter?</p>
<be>
<input type="checkbox" name="news" value="Yes" checked>
<label for="news">Yes, I would like to subscribe</label><br>
<input class="btns" name="btn-send" id="mySubmit" type="submit" value="submit">
<input class="btns" name="btn-reset" id="myReset" type="reset" value="reset">
</form>
Aucun commentaire:
Enregistrer un commentaire