-
Form Fields not working
Hi guys,
Well I finally figured out my forms for here http://www.creations4u.co.uk/contact.htm but for some reason the only info that is coming through the email is the telephone field. Just out of interest I changed the names of the fields and it is only that particular field that is coming through on the email (hope that makes sense!!) i have been studying and studying the php form trying to work out what it is i am doing wrong, but i just cannot figure it out.
PLEASE can somebody tell me where i am going wrong xxxxxxxxxxxxx
Here is the scripting if this is any help:
//clean input in case of header injection attempts!
function clean_input_4email($value, $check_all_patterns = true)
{
$patterns[0] = '/content-type:/';
$patterns[1] = '/to:/';
$patterns[2] = '/cc:/';
$patterns[3] = '/bcc:/';
if ($check_all_patterns)
{
$patterns[4] = '/\r/';
$patterns[5] = '/\n/';
$patterns[6] = '/%0a/';
$patterns[7] = '/%0d/';
}
//NOTE: can use str_ireplace as this is case insensitive but only available on PHP version 5.0.
return preg_replace($patterns, "", strtolower($value));
}
$name = clean_input_4email($_POST["name"]);
$email = clean_input_4email($_POST["email"]);
$telephone = clean_input_4email($_POST["telephone"]);
$message = clean_input_4email($_POST["message"], false);
$error_msg='ERROR - not sent. Try again.';
$success_sent_msg='<p align="center"><strong> </strong></p>
<p align="center"><strong>Your message has been successfully sent to us<br>
</strong> and we will reply as soon as possible.</p>
<p align="center">Thank you for contacting us.</p>';
$replymessage = "Hi $name
Thank you for your email.
We will endeavour to reply to you shortly.
Please DO NOT reply to this email.
Thank you";
// email variable not set - load $valid_ref1 page
if (!isset($_POST['email']))
{
echo "<script language=\"JavaScript\"><!--\n ";
echo "top.location.href = \"$valid_ref1\"; \n// --></script>";
exit;
}
$ref_page=$_SERVER["HTTP_REFERER"];
$valid_referrer=0;
if($ref_page==$valid_ref1) $valid_referrer=1;
elseif($ref_page==$valid_ref2) $valid_referrer=1;
if(!$valid_referrer)
{
echo "<script language=\"JavaScript\"><!--\n alert(\"$error_msg\");\n";
echo "top.location.href = \"$valid_ref1\"; \n// --></script>";
exit;
}
$themessage = "\nName: $name \nMessage: $message \nTelephone: $telephone";
mail("$replyemail",
"$thesubject",
"$themessage",
"From: $email\nReply-To: $email");
mail("$email",
"Receipt: $thesubject",
"$replymessage",
"From: $replyemail\nReply-To: $replyemail");
echo $success_sent_msg;
/*
PHP Form Mailer - phpFormMailer (e
-
-
please can anybody help me????
-
-
Try print_r($_POST); to see what data has actually been sent.
Daniel -
Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum
-
-
did you mean like this....
$name = clean_input_4email print_r($_POST);
sorry not sure where or how you mean.
-
-
nope...that isnt what you mean lol....(I just tried it lol)
could you please expalin further when you have the time.
many thanks
Sarah
-
-
Code:
echo print_r($_POST);
will display the post array, so you can see if your variables are being sent.
i.e if they aren't in the array, they aren't being sent.
-
-
ack still confused. :-(
where would i put this echo print_r($_POST); ?
sorry to be so stupid
-
-
ahhhaaaaa i get it...sorry for being a bit slow.
ok this is what comes up
Array ( [name_of_owner] => sarah [telephone] => 02392384798 [email] => sassyuk1@ntlworld.com [textfield] => test3 [Submit] => Submit ) 1
does this mean anything???
-
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