Hi Guys,
Been a long time fan of chronoform,
recently i've started developing solely on wordpress and i'm having a bit of an issue here basically can't find any documentation on it.
I am doing a newsletter subscription form and basically the form only saves to database using DBsave
So when a user submit a form, it should technically go to the database, and find the email column and if email exist, it will prompt message saying already registered
So naturally I use event switcher for this task.
This is what I have so far.
except that it woun't really work. I'm figuring this part out
Is that correct?
This one i took from joomla but i'm not sure if it is correct in WP
Been a long time fan of chronoform,
recently i've started developing solely on wordpress and i'm having a bit of an issue here basically can't find any documentation on it.
I am doing a newsletter subscription form and basically the form only saves to database using DBsave
So when a user submit a form, it should technically go to the database, and find the email column and if email exist, it will prompt message saying already registered
So naturally I use event switcher for this task.
This is what I have so far.
<?php
$db_host = 'xx';
$db_user = 'xx';
$db_pass = 'xx';
$db_name = 'xx';
/* Connect to the new database */
$externalQuery = new wpdb($db_user, $db_pass, $db_name, $db_host);
$match = $form->validation_errors['email'];
$newQuery = $externalQuery->get_results("SELECT COUNT(*) FROM cswp_chronoengine_chronoforms_datatable_eNewsletter WHERE email = '$match'") or die(mysql_error());
if ($newQuery) {
return "fail"; // user already registered
} else {
return "success";
}
//print_r($newQuery);
?>
except that it woun't really work. I'm figuring this part out
$form->validation_errors['email'];
Is that correct?
This one i took from joomla but i'm not sure if it is correct in WP