I have a form and the checkboxes are not posting back in the email.
I keep getting this error:
Warning: implode() [function.implode]: Invalid arguments passed in /home/content/26/11984126/html/verify2.php on line 76
Warning: Cannot modify header information - headers already sent by (output started at /home/content/26/11984126/html/verify2.php:76) in /home/content/26/11984126/html/verify2.php on line 92:
[php]
Company Name:
First Name:
Last Name:
Phone Number:
Email:
Check All that Apply:
Why are you considering Led’s?
Energy Savings
Save Money
Improve Lighting
Reduce Carbon Footprint
Eliminate Mercury Lighting
Reduce Maintenance
List estimated quantities in appropriate box for those that apply:
T-12
T-8
T-5
CFL’s
Metal Halide
High Pressure Sodium
Incandescents
Other
What is you run time?
Hrs
Days
Who is your utility company?
* What is your time-line for your project?
ASAP
3-6 months
7-12 months
13+ months
Questions:
<textarea name=“comments” id="comments "cols=“60” rows=“3” class=“news”>If you have any questions or concerns please write them here. We will get back to you within 12 Hours!
<?php require_once('../recaptchalib.php'); $publickey = "6LdJTcgSAAAAADgZHRRjfHXeYTFqm0fBOkt5tjio"; // you got this from the signup page echo recaptcha_get_html($publickey); ?>
<br />
<input name="Submit" type="submit" value="Get a Quote!" />
</form>[/php]
And here is the verify2 page:
[php]<?php
if(isset($_POST[‘Submit’])) {
require_once(’…/recaptchalib.php’);
$privatekey = “6LdJTcgSAAAAAKrE9gWY8YPk-m9uq441XLogmxrg”;
$resp = recaptcha_check_answer ($privatekey,
$_SERVER[“REMOTE_ADDR”],
$_POST[“recaptcha_challenge_field”],
$_POST[“recaptcha_response_field”]);
if (!$resp->is_valid) {
// What happens when the CAPTCHA was entered incorrectly
die (“The reCAPTCHA wasn’t entered correctly. Go back and try it again.” .
"(reCAPTCHA said: " . $resp->error . “)”);
} else {
// Your code here to handle a successful verification
// EDIT THE 2 LINES BELOW AS REQUIRED
$email_to = "[email protected],[email protected]";
$email_subject = “Request a Business Quote”;
function died($error) {
// your error code can go here
echo "We are very sorry, but there were error(s) found with the form you submitted. ";
echo "These errors appear below.<br /><br />";
echo $error."<br /><br />";
echo "Please go back and fix these errors.<br /><br />";
die();
}
// validation expected data exists
if(!isset($_POST['firstname']) ||
!isset($_POST['lastname']) ||
!isset($_POST['email']) ||
!isset($_POST['phonenumber'])) {
died('We are sorry, but there appears to be a problem with the form you submitted.');
}
$email_from2 = $_POST['email']; // required
$first_name2 = $_POST['firstname']; // required
$last_name2 = $_POST['lastname']; // required
$telephone2 = $_POST['phonenumber']; // not required
$comments2 = $_POST['comments']; // required
$recycleobject2 = $_POST['recycleobject']; // required
$error_message = "";
$email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
if(!preg_match($email_exp,$email_from2)) {
$error_message .= ‘The Email Address you entered does not appear to be valid.
’;
}
$string_exp = “/^[A-Za-z .’-]+$/”;
if(!preg_match($string_exp,$first_name2)) {
$error_message .= ‘The First Name you entered does not appear to be valid.
’;
}
if(!preg_match($string_exp,$last_name2)) {
$error_message .= ‘The Last Name you entered does not appear to be valid.
’;
}
if(strlen($comments2) < 2) {
$error_message .= ‘The Comments you entered do not appear to be valid.
’;
}
if(strlen($error_message) > 0) {
died($error_message);
}
$email_message = “Form details below.\n\n”;
function clean_string($string) {
$bad = array("content-type","bcc:","to:","cc:","href");
return str_replace($bad,"",$string);
}
$email_message .= "First Name: ".clean_string($first_name2)."\n";
$email_message .= "Last Name: ".clean_string($last_name2)."\n";
$email_message .= "Email: ".clean_string($email_from2)."\n";
$email_message .= "Telephone: ".clean_string($telephone2)."\n";
$email_message .= "Comments: ".clean_string($comments2)."\n";
$email_message .= "Lighting:" .implode(", ",$recycleobject2). "\n";
// create email headers
$headers = 'From: '.$email_from2."\r\n".
'Reply-To: '.$email_from2."\r\n" .
‘X-Mailer: PHP/’ . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);
$insertGoTo = “thankyou.php”;
if (isset($_SERVER[‘QUERY_STRING’])) {
$insertGoTo .= (strpos($insertGoTo, ‘?’)) ? “&” : “?”;
$insertGoTo .= $_SERVER[‘QUERY_STRING’];
}
header(sprintf(“Location: %s”, $insertGoTo));
}
}
?>
[/php]