Hi everybody
I have 2 models (User,Comp) and 2 Controllers
(users_controller,comps_controller).Users & Comps table have no
relationship.They are independent of one another.Now i have a login
View where there are four things {1} Input box for Username, {2} Input
box for Password , {3} Select box for installed Company Names and {4}
a submit button.
Now, Login View is generated from login action in the
users_controllers.php::::>>
var $name='Users';
var $helpers = array('Html','Form');
var $uses = array('User','Comp'); /*--Name of the Model this
Controller uses--*/
function index()
{
$this->layout='default_admin';
}
function login()
{
/*--------Name of the layout it
uses----------------------------------bgn*/
$this->layout = 'default'; /*--Name of the layout it uses from
the
directory app/views/layouts--*/
/
*--------------------------------------------------------------------
end*/
/*--------*/
//Call Comp Model using loadModel()
$this->loadModel('Comp');
$cNames = $this->Comp->find('list',array('fields'=>
array('Comp.comp_name')));
//$cNames = $this->Comp->query("SELECT comps.comp_name FROM
comps");
$this->set('compNames',$cNames);
//redirect user if already logged in
if ($this->Session->check('User'))
{
$this->redirect(array('action'=>'index'));
}
if (empty($this->data) == false)
{
//set the form data to enable Input data validation
$this->User->set($this->data);
//see if the input data validates
if($this->User->validates())
{
//check the user is valid
$result =
$this->User->check_user_data($this->data);
if($result !== false)
{
//save to session
$this->Session->write('User',$result);
/*--'User' name of the
session--*/
//show message
//$this->Session->setFlash('You have
successfully logged in');
//redirect to appropriate page
$this->redirect(array('action'=>'index'));
}
else
{
$this->Session->setFlash('Either your
Username or Password is
incorrect');
}
}
}
}
Username and Password are from User model but Company name is from
Comp model.Now i want to create a session variable and in there i want
to store the Company name selectd from the select box.Now, my problem
is how do i access the value of Select box in the controller so that i
could put it in a session variable under the following given
circumstances.Please advise
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en