[Topic edited by moderator.]
Hello,
I have a problem. I put the email form to my website, create the php file and when someone completes the form successfully then clicking the enter button (as submit), the email doesn't show up in my mailbox. Please help me 😄
HTML CODE:
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>BORING TEE</title>
<link href="style.css" rel="stylesheet" type="text/css">
<!-- Global site tag (gtag.js) - Google Analytics -->
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-109231661-2');
</script>
</head>
<body style="background-color:#000000;">
<div class="row2">
<div class="column2">
<img src="boringtee1.png" alt="Shop" class="smileytee">
</div>
<div class="column2">
<img src="boringtee2.png" alt="Shop" class="smileytee1">
</div>
</div>
<h5>pre order available soon</h5>
<h6>Limited to 100 pieces</h6>
<h6>shipping worldwide</h6>
<form class="email" action="email.php" method="post">
<input type="text" class="enter" style="background-color: #000000" name="email" placeholder="ENTER EMAIL FOR UPDATES">
</form>
<a href="shop.html">
<img src="back_button.png" class="back1" alt="backbutton"></a>
<script type="text/javascript">
$(document).ready(function () {
var makeAllFormSubmitOnEnter = function () {
$('form input, form select').live('keypress', function (e) {
if (e.which && e.which == 13) {
$(this).parents('form').submit();
return false;
} else {
return true;
}
});
};
makeAllFormSubmitOnEnter();
});
</script>
</body>
</html>
PHP CODE
<?php
if (isset($_POST['submit'])) {
$mailFrom = $_POST['email'];
$mailTo = "contact@22c11.club";
$headers = "From: ".$mailFrom;
$txt = "You have received an e-mail from customer";
mail($mailTo, $txt, $headers);
}
$conn = new mysqli ($mailTo, $headers, $txt);
?>