I have just published my new web site (www.duepadroni.it). On the index pages for all four languages I have used the contact form which in itself works fine. I receive the messages in my IN-box. The only problem I have is that the form also contains a date range, and this date range is not displayed in the email that I receive. Below is the HTML code for the form that I have used.
<form class="nobottommargin" id="template-contactform" name="template-contactform" action="include/sendemail.php" method="post">
<a id="Contact"></a>
<div class="col_one_third">
<label for="template-contactform-name">Naam <small>*</small></label>
<input type="text" id="template-contactform-name" name="template-contactform-name" value="" class="sm-form-control required" />
</div>
<div class="col_one_third">
<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" />
</div>
<div class="col_one_third col_last">
<label for="template-contactform-phone">Telefoon</label>
<input type="text" id="template-contactform-phone" name="template-contactform-phone" value="" class="sm-form-control" />
</div>
<div class="clear"></div>
<div class="col_two_third">
<label for="template-contactform-subject">Onderwerp <small>*</small></label>
<input type="text" id="template-contactform-subject" name="template-contactform-subject" value="" class="required sm-form-control" />
</div>
<div class="col_one_third col_last">
<label for="template-contactform-service">Betreft</label>
<select id="template-contactform-service" name="template-contactform-service" class="sm-form-control">
<option value="">-- Maak uw keuze --</option>
<option value="Algemeen">Algemeen</option>
<option value="Loggione">Appartement Loggione</option>
<option value="Cantinetta">Appartement Cantinetta</option>
</select>
</div>
<div class="col-sm-6 bottommargin-sm">
<div class="input-daterange travel-date-group bottommargin-sm">
<label for="template-contactform-daterange">periode</label>
<div class="input-daterange input-group">
<span class="input-group-addon">van</span>
<input type="text" id="template-contactform-van" value="" class="sm-form-control tleft" placeholder="DD/MM/YYYY">
<span class="input-group-addon">tot</span>
<input type="text" id="template-contactform-tot" value="" class="sm-form-control tleft" placeholder="DD/MM/YYYY">
</div>
</div>
</div>
<div class="clear"></div>
<div class="col_full">
<label for="template-contactform-message">Bericht <small>*</small></label>
<textarea class="required sm-form-control" id="template-contactform-message" name="template-contactform-message" rows="6" cols="30"></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 class="col_full">
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
<div class="g-recaptcha" data-sitekey="6LeAcWQUAAAAANyLIqc7DbvNvJ8cpqyehDhIbntz"></div>
</div>
<div class="col_full">
<button class="button button-3d nomargin" type="submit" id="template-contactform-submit" name="template-contactform-submit" value="submit">Verstuur bericht</button>
</div>
</form>I have also made some changes to the seandmail.php file as instructed in the manual:
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'] : '';
$service = isset( $_POST['template-contactform-service'] ) ? $_POST['template-contactform-service'] : '';
$van = isset( $_POST['template-contactform-van'] ) ? $_POST['template-contactform-van'] : '';
$tot = isset( $_POST['template-contactform-tot'] ) ? $_POST['template-contactform-tot'] : '';
$daterange = isset( $_POST['template-contactform-daterange'] ) ? $_POST['template-contactform-name'] : '';
$subject = isset( $_POST['template-contactform-subject'] ) ? $_POST['template-contactform-subject'] : '';
$message = isset( $_POST['template-contactform-message'] ) ? $_POST['template-contactform-message'] : '';
$subject = isset($subject) ? $subject : 'New Message From Contact Form';
$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
" : '';
$service = isset($service) ? "Service: $service
" : '';
$van = isset($name) ? "van: $van
" : '';
$tot = isset($name) ? "tot: $tot
" : '';
$daterange = isset($newfield) ? "Date Range: $daterange
" : '';
$message = isset($message) ? "Message: $message
" : '';
$referrer = $_SERVER['HTTP_REFERER'] ? '
This Form was submitted from: ' . $_SERVER['HTTP_REFERER'] : '';
$body = "$name $email $phone $service $van $tot $daterange $message $referrer";The result what I see in my mail is:
Name: nico boots
Email: boots@planet.nl
Phone: 09876543123
Service: Loggione
van:
tot:
Message: testen
As you can see dates are not displayed. Can you tell me how to solve this?
This Form was submitted from: http://www.duepadroni.it/indexIT.php
