Hi - I have limited knowledge of PHP, but I have a form that I have used on a few sites, which is now giving me trouble. Can someone please help! I keep getting error messages when I click submit to test.
Here is the HTML:
<form action="email.php" method="POST">
<input type="hidden" value="kate@bellami-designboutique.com" name="email">
<input type="hidden" value="Mailing List Subscriber" name="subject">
Email: <input type="text" name="email" />
<input type="submit" value="submit" name="submit">
</form>
Here is the PHP (email.php):
<?php
if(isset($_POST['submit'])) {
# Form declarations
$to = "kate@bellami-designboutique.com";
$subject = "Mailing List Subscriber";
$from = "Mailing List Subscriber";
$name_field = $_POST['name'];
$email_field = $_POST['email'];
foreach($_POST['check'] as $value) {
$check_msg .= "$value\n";
}
$body = "
E-Mail: $email_field\n";
$success = mail($to, $subject, $body, "From: \"$name_field\" <$email_field>");
}
if ($success){
header('Location: thankyouemail.html');
} else {
header('Location: emailerror.html');
}
?>
This is the error message:
Warning: Invalid argument supplied for foreach() in /home/livean5/public_html/f5/email.php on line 11
Warning: Cannot modify header information - headers already sent by (output started at /home/livean5/public_html/f5/email.php:11) in /home/livean5/public_html/f5/email.php on line 23