I am having trouble with a website quote form. I am new to pho and have no idea what is happening.When I press get quote, I get this error:
Warning: implode() [function.implode]: Invalid arguments passed in /home/content/26/11984126/html/verify2.php on line 79
Warning: Cannot modify header information - headers already sent by (output started at /home/content/26/11984126/html/verify2.php:79) in /home/content/26/11984126/html/verify2.php on line 94
The page it is come from is this:
[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['company']) ||
!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
$company2 = $_POST['company']; // required
$first_name2 = $_POST['firstname']; // required
$last_name2 = $_POST['lastname']; // required
$telephone2 = $_POST['phonenumber']; // not required
$comments2 = $_POST['comments']; // required
$lightingobject2 = $_POST['lightingobject']; // 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 .= "Company Name: ".clean_string($company2)."\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(", ",$lightingobject2). "\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]