1) Get recaptcha keys from http://www.google.com/recaptcha
2) Set these keys to recaptcha plugin and activate it if it's not.
3) Put below code where you want to show recaptcha
php code:
JPluginHelper::importPlugin('captcha');
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger('onInit','dynamic_recaptcha_1');
html code inside form tag
<div id="dynamic_recaptcha_1"></div>
I putted this code in my htmp page:
$post = JFactory::getApplication()->input->post;
$dispatcher = JEventDispatcher::getInstance();
$res=$dispatcher->trigger('onCheckAnswer',$post['recaptcha_response_field']);
if(!$res[0]){
die('Invalid Captcha');
}
I placed the above code but after submitting the form I receive a blank page. Can you explain why?