Whats wrong with this?
Hi,
Im getting these once ive clicked "Submit"
Notice: Undefined index: check in /home/fhlinux172/b/*****.com/user/htdocs/mailer.php on line 21
Warning: Invalid argument supplied for foreach() in /home/fhlinux172/b/best******.com/user/htdocs/mailer.php on line 21
Notice: Undefined variable: check_msg in /home/fhlinux172/b/best*****.com/user/htdocs/mailer.php on line 27
Notice: Undefined variable: confrimemail_field in /home/fhlinux172/b/best*****.com/user/htdocs/mailer.php on line 27
CODE:
<?php
if(isset($_POST['submit'])) {
$to = "info@*****.co.uk";
$subject = "From Best*****.com Online Query";
$name_field = $_POST['name'];
$email_field = $_POST['email'];
$confirmemail_field = $_POST['confirmemail'];
$message = $_POST['message'];
$dropdown = $_POST['drop_down'];
foreach($_POST['check'] as $value) {
$check_msg .= "Checked: $value\n";
}
//You needed a from header.
$headers = "From: ".$email_field." \n";
$body = "From: $name_field\n E-Mail: $email_field\n $check_msg Confirm E-mail: $confrimemail_field\n `Drop-Down: $dropdown\n Message:\n $message\n";
mail($to, $subject, $body, $headers);
echo "Data has been submitted to $to!";
} else {
echo "blarg!";
}
?>
I dont understand PHP that much and i deffiantly dont understand why it is giving me Undifined Variables.
Hope you can help.
Crast
Please can anybody help this is urgent...
You can help us to help you by using the [php] bbcode tags around your code sample, and indicating (perhaps with comments?) which lines are the line numbers cited in the error messages.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in
Nation
eBookworm.us
Sound Advise.
Also, double check the form field named check, if there even is one. I suspect your form is not submitting one so $_POST['check'] is not being found.
The rest of the issues may cascade from there.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Bookmarks