How Can We Help?
- Click on the form name under the Forms Management tab and ensure that Data storage is enabled
- Next click on the Validation Tab
- Scroll down to the Server Side Validation and set Enable Server Side Validationto yes
- In the text area Server Side Validation Code add the following code
<?php $db =& JFactory::getDBO(); $query = " SELECT count(*) FROM `jos_chronoforms_table` WHERE `text_9` = ".$db->Quote($_POST['text_9'])."; "; $db->setQuery($query); if ( $db->loadResult() ) { return "You've already entered this competition"; } ?>
Replace jos_chronoforms_table with the table name where you are storing the form submission data.
In the code above we validate the user against the field_9 column in the database table jos_chronoforms_table, if the value entered already exist injos_chronoforms_table in the field_9 column it means the user has submitted the form.
Our field_9 in the above example contains the email address, so if the entered email address exist in the table in means that the user already submitted the form
The global variable $_POST[‘text_9’] contains the form field text_9’s value that the user entered.
You may want to replace field_9 with your column to check against.