...

View Full Version : Message is not working in form



quartzy
05-30-2011, 06:17 PM
I have this form that I use for my sites, but the message bit is not showing on submit. It must be the php code of the message bit can anyone help?

<?php
session_start();

require_once('recaptchalib.php');
$privatekey = "removed";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);

// Get variables from your form ...
$username = $_POST['name'];
$useremail = $_POST['email'];
$usersubject = $_POST ['subject'];

// Save the form variables in SESSION
// We will be using this later.
$_SESSION['username'] = $_POST['name'];
$_SESSION['useremail'] = $_POST['email'];
$_SESSION['usersubject'] = $_POST['skills'];

// Who the form gets sent to ...
$recipient = "removed";
$subject = "Website Form";

// Where to go after the user submits the form ...
$redirect = "../venue/venue_thank_you.html";

if (!$resp->is_valid) {
// What happens when CAPTCHA entered incorrectly ...$redirect = "../thanks.html";
// What happens when CAPTCHA entered incorrectly ...
die ("<div id='captcha_error'>The reCAPTCHA wasn't entered correctly. Go back and try it again." .
"(reCAPTCHA said: " . $resp -> error . ")</div>");
} else {
// Successful captcha, so continue on with the email ...
}

$message = "
================================
Name: $username
Email: $useremail
Subject: $usersubject
-----------------------------------------
$fmessage
================================
";

$extraheaders = "From: $useremail\r\nReply-To: $useremail\r\n";

if (! mail($recipient, $subject, $message, $extraheaders))
echo "Mail did not send for some reason.";

header('Location:'.$redirect);

?>

tangoforce
05-30-2011, 07:01 PM
With 763 posts i'm sure you've read about using [php] tags but just in case there is a link in my signature for you ;)

shadowmaniac
05-30-2011, 07:27 PM
<?php
// Get variables from your form ...
$username = $_POST['name'];
$useremail = $_POST['email'];
$usersubject = $_POST ['subject'];

// Should be an
$fmessage = $_POST['something'];
// somewhere around here



You're using "$fmessage" variable in your $message variable but I don't see where you're actually assigning anything to "$fmessage"

quartzy
05-31-2011, 12:54 PM
Hello
Thanks you for offering to help but there is no help here. I dont know php. And just need the code to work.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum