However, it does not work and I can keep sending out the completed form with the same inputPls adviseRgdsK"> Check to avoid double records in the DB - Forums

Forums

Check to avoid double records in the DB

SPABO 17 Mar, 2016
Hi Bob,

I have put the following code in the tab Others/Custom PHP code/Before emails code
<?php
$naam = JRequest::getString('naam', '', 'post');
$email1 = JRequest::getString('email1', '', 'post');
if ( $naam && $email1) {
  $db =& JFactory::getDBO();
  $query = "
    SELECT COUNT(*)
      FROM `vs2cm_chronoforms_data_xxxx`
      WHERE `naam` = '{$naam}'
        AND `email1` = '{$email1}';
  ";
 $db->setQuery($query);
  $count = $db->loadResult();
  if ( $count > 0 ) {
    $form->validation_errors[''] = "U heeft dit formulier reeds ingevuld!";
    return false;
  }}
?>


However, it does not work and I can keep sending out the completed form with the same input

Pls advise

Rgds
K
SPABO 18 Mar, 2016
Answer
Hi Bob,
I chaanged teh settings to Advancxed, and now I could add the Custom Serverside Validation tool.
Now it works fine!

Best rgds
K
This topic is locked and no more replies can be posted.