On Nov 3, 9:38 am, Antar <[email protected]> wrote: > On Nov 3, 12:25 am, cricket <[email protected]> wrote: > > > On Tue, Nov 2, 2010 at 10:23 AM, Antar <[email protected]> wrote: > > > Hi > > > > May seem very basic but I have a login form that expects a username & > > > password and a location. The location is chosen from a select and I > > > want to write the selected location to the session data for the user. > > > I need in passing the chosen location id from the form to the > > > controller. > > > Get it from $this->data. > > I am trying that but I can't get any values. I have the following in > the form (The select lists the locations ('depot') as it should do) > > <h2>Login</h2> > <?php > echo $session->flash('auth'); > echo $this->Form->create('User', array('url' => array('controller' => > 'users', 'action' =>'login'))); > echo $this->Form->input('User.username'); > echo $this->Form->input('User.password'); > echo $form->input('depot', array('options' => > array($depotlist),'selected' => $this->data['User']['depot'],'label' > => 'Depot')); > > I have the following in the user_controller.php > > function login() > { > > $data_array = $this->Depot->find('all',array('fields' > => > array('Depot.id', 'Depot.name'))); //For all of the records in the > table > $data_combine = Set::combine($data_array, > '{n}.Depot.id','{n}.Depot.name'); > $this->set('depotlist',$data_combine); > if ($this->Auth->user()) > { > print_r($this->data['User']['depot']); > $this->Session->write('depot', > $this->data['User'] > ['depot']); // this is the 'real write' that doesn't work > // $this->Session->write('depottest', > 'testdepot'); // this > write is for test only & works > $this->redirect($this->Auth->redirect()); > > } > > } > > I assume, because the test write does work, that $this->data is never > populated
Am not sure what I did but this is working now. The wonders of cakephp ;-) 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
