Hi,
I am currently using your awesome landing, but I have a problem passing the values coming from a multiple select field in the contact form.
You can see a live example here: https://goo.gl/TkF2xh
I edited the file sendemail.php following some other threads in this forum and I have only this problem. If you select more than one values in the field 'SELEZIONA I FORMATI CHE TI INTERESSANO*', in the mail I receive I can see only one value. Here you can find my sendemail.php:
'samplemail@samplesite.it', // Your Email Address
'name' => 'SativaClick' // Your Name
);
// Form Processing Messages
$message_success = 'Abbiamo ricevuto il tuo messaggio **correttamente**. Ti ricontatteremo il prima possibile.';
// Add this only if you use reCaptcha with your Contact Forms
//$recaptcha_secret = 'your-recaptcha-secret-key'; // Your reCaptcha Secret
$mail = new PHPMailer();
// If you intend you use SMTP, add your SMTP Code after this Line
if( $_SERVER['REQUEST_METHOD'] == 'POST' ) {
if( $_POST['template-contactform-email'] != '' ) {
$name = isset( $_POST['template-contactform-name'] ) ? $_POST['template-contactform-name'] : '';
$email = isset( $_POST['template-contactform-email'] ) ? $_POST['template-contactform-email'] : '';
$phone = isset( $_POST['template-contactform-phone'] ) ? $_POST['template-contactform-phone'] : '';
$city = isset( $_POST['template-contactform-city'] ) ? $_POST['template-contactform-city'] : '';
$website = isset( $_POST['template-contactform-website'] ) ? $_POST['template-contactform-website'] : '';
$service = isset( $_POST['template-contactform-service'] ) ? $_POST['template-contactform-service'] : '';
$budget = isset( $_POST['template-contactform-budget'] ) ? $_POST['template-contactform-budget'] : '';
$subject = isset( $_POST['template-contactform-subject'] ) ? $_POST['template-contactform-subject'] : '';
$message = isset( $_POST['template-contactform-message'] ) ? $_POST['template-contactform-message'] : '';
$subject = isset($subject) ? $subject : 'Hai ricevuto un nuovo messaggio dal modulo di contatto';
$botcheck = $_POST['template-contactform-botcheck'];
if( $botcheck == '' ) {
$mail->SetFrom( $email , $name );
$mail->AddReplyTo( $email , $name );
foreach( $toemails as $toemail ) {
$mail->AddAddress( $toemail['email'] , $toemail['name'] );
}
$mail->Subject = $subject;
$name = isset($name) ? "Name: $name
" : '';
$email = isset($email) ? "Email: $email
" : '';
$phone = isset($phone) ? "Phone: $phone
" : '';
$city = isset($city) ? "City: $city
" : '';
$website = isset($website) ? "Sito Web/Facebook: $website
" : '';
$service = isset($service) ? "Service: " . ( is_array($service) ? implode( ', ', $service ) : $service ) . "
" : '';
$budget = isset($budget) ? "Budget: $budget
" : '';
$message = isset($message) ? "Message: $message
" : '';
$referrer = $_SERVER['HTTP_REFERER'] ? '
This Form was submitted from: ' . $_SERVER['HTTP_REFERER'] : '';
$body = "$name $email $phone $city $website $service $budget $message $referrer";
if( isset( $_FILES['template-contactform-file'] ) AND is_array( $_FILES['template-contactform-file'] ) ) {
$countfiles = count( $_FILES['template-contactform-file'] );
for( $i=0; $i IsHTML(true);
$mail->AddAttachment( $_FILES['template-contactform-file']['tmp_name'][$i], $_FILES['template-contactform-file']['name'][$i] );
}
}
}
// Runs only when reCaptcha is present in the Contact Form
if( isset( $_POST['g-recaptcha-response'] ) ) {
$recaptcha_response = $_POST['g-recaptcha-response'];
$response = file_get_contents( "https://www.google.com/recaptcha/api/siteverify?secret=" . $recaptcha_secret . "&response=" . $recaptcha_response );
$g_response = json_decode( $response );
if ( $g_response->success !== true ) {
echo '{ "alert": "error", "message": "Captcha not Validated! Please Try Again." }';
die;
}
}
$mail->MsgHTML( $body );
$sendEmail = $mail->Send();
if( $sendEmail == true ):
echo '{ "alert": "success", "message": "' . $message_success . '" }';
else:
echo '{ "alert": "error", "message": "Email **could not** be sent due to some Unexpected Error. Please Try Again later.
**Reason:**
' . $mail->ErrorInfo . '" }';
endif;
} else {
echo '{ "alert": "error", "message": "Bot **Detected**.! Clean yourself Botster.!" }';
}
} else {
echo '{ "alert": "error", "message": "Please **Fill up** all the Fields and Try Again." }';
}
} else {
echo '{ "alert": "error", "message": "An **unexpected error** occured. Please Try Again later." }';
}
?>
Please can you check why this is happened?
Thank you!
