Hi, all.
I have a login form with a checkbox that needs to create cookies if checked. How is it possible to check after the form has been submitted if the checkbox has been checked?
I have the following code in 'application/forms/Login.php':
$remember = new Zend_Form_Element_Checkbox("remember", array('disableLoadDefaultDecorators' => true, 'required' => false));
$remember->setDecorators(array('ViewHelper', array('Description', array('escape' => false, 'tag' => 'span'))))->setDescription("Remember me");
And in 'application/controllers/Auth.php':
$form = new Application_Form_Login();
$request = $this->getRequest();
if($request->isPost() && $request->getPost('submit_login')) {
if($form->isValid($request->getPost())) {
if ($this->_process($form->getValues())) {
$data = $form->getValues();
if(isset($data['remember'])){
setcookie("username", $data['username'], time()+60*60*24*100, "/");
setcookie("password", $data['password'], time()+60*60*24*100, "/");
}
}
}
}
The code works fine, but it creates cookis, no matter if checked or unchecked. Please advise. Thank you.