Skip to content

Instantly share code, notes, and snippets.

@fkumro
Created June 12, 2009 14:55
Show Gist options
  • Save fkumro/128675 to your computer and use it in GitHub Desktop.
Save fkumro/128675 to your computer and use it in GitHub Desktop.
<?php
function someAction()
{
$this->load->library('form_validation');
// set validation rule for the recaptcha response
$this->form_validation->set_rules('recaptcha_response_field', 'reCaptcha', 'required|callback_recaptcha_check');
if ($this->form_validation->run() === FALSE)
{
// store the recaptcha html code for the view
$data['recaptcha'] = recaptcha_get_html($this->_recaptcha_public_key);
// pass the data to the view
$this->load->view('someView', $data);
}
else
{
// party
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment