Soig
December 5th, 2006, 04:40 PM
Hey Guys, I'm having a hard time with a simple code. I got this from a website and I only eddited what I needed to. But wehn I use it, it gives me this result
Warning: Invalid argument supplied for foreach() in /home/u2xs/public_html/magnum/php/mailer.php on line 11
The Entire Code is
<?php
if(isset($_POST['submit'])) {
$to = "sergio@u2xs.com";
$subject = "A question from $name at MT.com";
$name = $_POST['name'];
$company = $_POST['company'];
$eMail = $_POST['eMail'];
$telephone = $_POST['telephone'];
$message = $_POST['message'];
foreach($_POST['check'] as $value) {
$check_msg .= "Checked: $value\n";
}
$body = " Name: $name\n E-Mail: $eMail\n Company: $company\n Telephone: $telephone\n Message: $message";
echo "<HTML><body bgcolor=0C2776 text=white><font size=7>Thank you</font></body</html>";
mail($to, $subject, $body);
} else {
echo "blarg!";
}
?>
The part I believe has a mistake is this one...
foreach($_POST['check'] as $value) {
$check_msg .= "Checked: $value\n";
}
Any thoughts??? Thanks
Warning: Invalid argument supplied for foreach() in /home/u2xs/public_html/magnum/php/mailer.php on line 11
The Entire Code is
<?php
if(isset($_POST['submit'])) {
$to = "sergio@u2xs.com";
$subject = "A question from $name at MT.com";
$name = $_POST['name'];
$company = $_POST['company'];
$eMail = $_POST['eMail'];
$telephone = $_POST['telephone'];
$message = $_POST['message'];
foreach($_POST['check'] as $value) {
$check_msg .= "Checked: $value\n";
}
$body = " Name: $name\n E-Mail: $eMail\n Company: $company\n Telephone: $telephone\n Message: $message";
echo "<HTML><body bgcolor=0C2776 text=white><font size=7>Thank you</font></body</html>";
mail($to, $subject, $body);
} else {
echo "blarg!";
}
?>
The part I believe has a mistake is this one...
foreach($_POST['check'] as $value) {
$check_msg .= "Checked: $value\n";
}
Any thoughts??? Thanks