Hey guys,
I have a questionnaire 2-page setup and chronoforms emails the user upon completion of the questionnaire and provides a randomly generated code as a discount voucher code.
Naturaly we don't want people using the same email address more than once, so from searching the forum I have been attempting to implement the following code in the OnSubmit before email box:
As I said it is a 2-page form, so I have tried the above code in the OnSubmit before email box for each of the forms and the mother form. Where should it go? And does anyone know why it's not working?
All the best,
Al
I have a questionnaire 2-page setup and chronoforms emails the user upon completion of the questionnaire and provides a randomly generated code as a discount voucher code.
Naturaly we don't want people using the same email address more than once, so from searching the forum I have been attempting to implement the following code in the OnSubmit before email box:
<?php
$email = JRequest::getInt('email', '', 'post');
if ( !$email ) {
return "You must enter an email address";
}
$db =& JFactory::getDBO();
$query = "
SELECT count(*)
FROM `registration_mother`
WHERE `email` = ".$db->Quote($quote)." ;
";
$db->setQuery($query);
$in_use = $db->loadResult();
if ( $in_use) {
return "That email is already registered";
}
?>
As I said it is a 2-page form, so I have tried the above code in the OnSubmit before email box for each of the forms and the mother form. Where should it go? And does anyone know why it's not working?
All the best,
Al