De uitkomst moet zijn: indien men het vinkje "privacy policy" aanvinkt (verplicht veld), wordt er in de verzonden email aangeduid dat men dit heeft gedaan (bevestiging). Ik vind de juiste code niet voor in de php file rond lijn 34: $checkbox = ... Ik vermoed toch dat de rest ok is. Wat zou ik hier moeten toevoegen om dit correct op te nemen? Alvast bedankt voor de hulp.
Contactform:
<form class="nobottommargin" id="template-contactform" name="template-contactform" action="include/sendemail-gastenboek.php" method="post">
<div class="form-process"></div>
<div class="col_one_fourth">
<label for="template-contactform-name">Naam - Name <small>*</small></label>
<input type="text" id="template-contactform-name" name="template-contactform-name" value="" class="sm-form-control required" placeholder="Uw naam - Your name" />
</div>
<div class="col_one_fourth">
<label for="template-contactform-email">Email <small>*</small></label>
<input type="email" id="template-contactform-email" name="template-contactform-email" value="" class="required email sm-form-control" placeholder="Uw email - Your email" />
</div>
<div class="col_one_fourth">
<label for="template-contactform-website">Website</label>
<input type="text" id="template-contactform-website" name="template-contactform-website" value="" class="sm-form-control" placeholder="Website URL" />
</div>
<div class="col_one_fourth col_last">
<label for="template-contactform-blog">Blog</label>
<input type="text" id="template-contactform-blog" name="template-contactform-blog" value="" class="sm-form-control" placeholder="Blog URL" />
</div>
<div class="col_full">
<label for="template-contactform-message">Bericht - Message <small>*</small></label>
<textarea class="required sm-form-control" id="template-contactform-message" name="template-contactform-message" rows="4" cols="30" placeholder="Uw bericht - Your message"></textarea>
</div>
<div class="col_full hidden">
<input type="text" id="template-contactform-botcheck" name="template-contactform-botcheck" value="" class="sm-form-control" />
</div>
<div>
<input id="checkbox-privacypolicy" class="required checkbox-style" name="checkbox-1" type="checkbox">
<label for="checkbox-privacypolicy" class="checkbox-style-3-label">Ik heb de <a href="privacy-policy.html" title="privacy policy">Privacy policy</a> gelezen en goedgekeurd.<small>*</small> / I have read and accepted the <a href="privacy-policy.html" title="privacy policy">Privacy policy</a> <small>*</small></label>
</div>
<div class="col_full">
<button class="button button-3d nomargin" type="submit" id="template-contactform-submit" name="template-contactform-submit" value="submit">Verstuur naar ons gastenboek - Send to our guestbook</button>
</div>
</form>Php sendemail:
<?php
require_once('phpmailer/class.phpmailer.php');
$mail = new PHPMailer();
if( isset( $_POST['template-contactform-submit'] ) AND $_POST['template-contactform-submit'] == 'submit' ) {
if( $_POST['template-contactform-name'] != '' AND $_POST['template-contactform-email'] != '' AND $_POST['template-contactform-message'] != '' AND $_POST['checkbox-privacypolicy'] != '' ) {
$name = $_POST['template-contactform-name'];
$email = $_POST['template-contactform-email'];
$website = $_POST['template-contactform-website'];
$blog = $_POST['template-contactform-blog'];
$message = $_POST['template-contactform-message'];
$checkbox = $_POST['checkbox-privacypolicy'];
$subject = isset($subject) ? $subject : 'Gastenboek bericht van ....be';
$botcheck = $_POST['template-contactform-botcheck'];
$toemail = '[email protected]';
$toname = 'Frederic D.';
if( $botcheck == '' ) {
$mail->SetFrom( $email , $name );
$mail->AddReplyTo( $email , $name );
$mail->AddAddress( $toemail , $toname );
$name = isset($name) ? "Name: $name<br><br>" : '';
$email = isset($email) ? "Email: $email<br><br>" : '';
$website = isset($website) ? "Website: $website<br><br>" : '';
$blog = isset($blog) ? "Blog: $blog<br><br>" : '';
$checkbox =
$referrer = $_SERVER['HTTP_REFERER'] ? '<br><br><br>Dit gastenboek bericht is verstuurd van: ' . $_SERVER['HTTP_REFERER'] : '';
$body = "$name $email $website $blog $message $checkbox $referrer";
$mail->MsgHTML( $body );
$sendEmail = $mail->Send();
if( $sendEmail == true ):
echo 'We hebben uw verzoek <strong>goed ontvangen</strong>. We zullen dit de komende uren/dagen bekijken.';
else:
echo 'Email <strong>could not</strong> be sent due to some Unexpected Error. Please Try Again later.<br /><br /><strong>Reason:</strong><br />' . $mail->ErrorInfo . '';
endif;
} else {
echo 'Bot <strong>Detected</strong>.! Clean yourself Botster.!';
}
} else {
echo 'Vul <strong>alle velden</strong> opnieuw in en probeer opnieuw.';
}
} else {
echo 'Er doet zich <strong>een probleem</strong> voor. Probeer later opnieuw.';
}
?>