how to get the value on form input in cakephp

cakephp, php, validation

Solution

You can get it

$val = $this->data['ModelName']['username']; //CakePHP 1.X.X

//or

$this->request->data['ModelName']['username']); //CakePHP 2.X.X

Where "ModelName" is your currently assigned model to form.

Update:

$user = $this->Account->find('first', array(
   'conditions' => array(
      'username' => 'user1'
   )
));

Problem

I have: ``` echo $this->Form->input('username', array('label' => 'Username: ')); ``` equivalent to in traditional php coding.. how can I get the value inputted in that textbox like when you do $val = $_POST['username']; in traditional php coding. I need this for login validation. thanks

Original source