Hi Guys,
This is my text field and button form.
<form method="post" action="mailcontadinobio.php">
<p align="center">
<input type="email" class="inputs" placeholder="esempio: mail@ilcontadinobio.it">
<table height="50" border="0">
<tr>
<td><div align="center">
<button type="submit" class="button animated" id="subscribe_button"><p>✓</p></button>
</div>
</td>
</tr>
</table>
</form>
<?php
/* Set e-mail recipient */
$myemail = "mail@ilcontadinobio.it";
$subject = "New e-mail address from ilcontadinobio.it";
$emailErr = "";
/* If e-mail is not valid show error message */
if (empty($_POST["email"])) {
$emailErr = "Email is required";
} else {
$email = $_POST["email"];
// check if e-mail address is well-formed
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
$emailErr = "Invalid email format";
}
}
/* Let's prepare the message for the e-mail */
$message = "E-mail: $email";
/* Send the message using mail() function */
mail($myemail, $subject, $message);
/* Redirect visitor to the thank you page */
header('Location: azienda.html');
exit();
function show_error( $emailErr)
{
?>
<html>
<body>
<strong><?php echo $emailErr; ?></strong>
<p>Hit the back button and try again</p>
</body>
</html>
<?php
exit();
}
?>
The e-mail get sent over perfectly, but there is no trace of what is submitted in the text field.
I have no clue what is missing in the code.
Can you help me?