[Moved to its own thread and added PHP tags around code. -- MOD]
Hi,
I do also receive blank emails when filling out the form on my website. Can somebody please help me???
See the page controller file below as well as the contact page file:
}
function contact() {
if(!empty($this->data)) {
if($this->Recaptcha->isValid() || Configure::read('Recaptcha.enabled') == false) {
$this->Page->set($this->data);
if($this->Page->validates()) {
$data['Page'] = $this->data['Page'];
if(!empty($data['Page']['department_id'])) {
$department = $this->Department->read(null, $data['Page']['department_id']);
$data['Department'] = $department['Department'];
}
$data['delivery'] = 'mail';
$data['from'] = $this->data['Page']['name'].' <'.$this->data['Page']['email'].'>';
if(!empty($data['Department']['email'])) {
$data['to'] = $data['Department']['email'];
} else {
$data['to'] = $this->appConfigurations['email'];
}
$data['subject'] = sprintf(__('%s - Contact gewenst', true), $this->appConfigurations['name']);
$data['template'] = 'pages/contact';
$this->_sendEmail($data);
$this->Session->setFlash(__('Uw bericht is verzonden.', true), 'default', array('class' => 'success'));
$this->redirect('/contact');
} else {
$this->Session->setFlash(__('Uw bericht is niet verzonden. Gelieve onderstaande foutmelding(en) te corrigeren en opnieuw te proberen.', true));
}
} else {
$this->Session->setFlash(__('Het verificatie formulier is niet correct ingevuld. Probeert u het opnieuw.', true), 'default', array('class' => 'message'));
$this->set('recaptchaError', $this->Recaptcha->error);
}
}
$this->pageTitle = __('Neem contact op', true);
$this->set('departments', $this->Department->find('list', array('order' => array('name' => 'asc'))));
}
And below the contact page file:
<div class="box clearfix">
<div class="f-top-w clearfix"><h2><?php __('Contact');?></h2>
<p>Vult u onderstaand formulier volledig in en wij nemen z.s.m. contact met u op. </p></div>
<div class="f-repeat clearfix">
<div class="content">
<p class="txt" style="padding-bottom:0; margin:0 0 20px;"><?php echo $j['contact_txt1']; ?></p>
<p class="txt bold" style="paddin-top:0;"><?php echo $j['contact_txt2']; ?></p>
<?php echo $form->create(null, array('url' => '/contact')); ?>
<fieldset class="contact">
<legend></legend>
<?php
echo $form->input('Uw naam :', array('label' => $j['contact_name']));
echo $form->input('Uw e-mail adres :', array('class' => 'disabled', 'label' => $j['contact_mail']));
if(!empty($departments)) :
echo $form->input('department_id', array('label' => $j['contact_department'], 'empty' => '選択して下さい', ));
endif;
echo $form->input('Uw bericht :', array('label' => $j['contact_desc'], 'type' => 'textarea'));
?>
<?php if(Configure::read('Recaptcha.enabled')):?>
<label><?php __('Verificatie');?></label>
<?php echo $recaptcha->getHtml(!empty($recaptchaError) ? $recaptchaError : null);?>
<?php endif;?>
<?php echo $form->end(__('Verzend', true));?>
</fieldset>
</div>
</div>
<div class="f-bottom-top clearfix"><p class="page_top"><a href="#" id="link_to_top">Naar boven</a></p></div>
</div>
I would really appreciate your help! I already invested over 40 hours and tried all i can.
Kind regards,
Brigitta