[eluser]Prasad.P[/eluser]
Hi everybody,
we are trying to create Captcha and store the captcha word using session. The Captcha is generated in one function and the validation is done in another function, problem here is the session what we create in first function is not accessible in the other function. Here are the two functions
class Captchacontroller1 extends Controller
{
function Captchacontroller1()
{
parent::controller();
$this->load->helper('url');
$this->load->helper('form');
$this->load->plugin('captcha');
$this->load->library('session');
}
function index()
{
$vals = array(
'img_path' => './captcha/',
'img_url' => base_url().'captcha/',
'font_path' => './system/fonts/gara.ttf',
'img_width' => '90',
'img_height' => 24
);
$captcha = create_captcha( $vals );
$this->session->set_userdata('foo',$captcha['word']);
$data['title']="Captcha";
$data['heading']="Creating Captcha";
$data['image'] = $captcha['image'];
$this->load->view('captchaview',$data);
}
function printtxt()
{
echo $this->session->userdata('foo');
}
}
Thanks in Advance.