I\'ve got a scaffold built for CakePHP, but need to have a way for users to type in part of a surname into a text box, click a button and for the list of people to be filtered t
views/users/index.ctp
controllers/users_controller.php
public function index($surname = null) {
// post-redirect-get
if ($this->data['User']['surname']) {
$this->redirect(array('id' => $this->data['User']['surname']));
}
// conditions
$conditions = null;
if ($surname) {
$conditions = array('surname LIKE' => '%' . $surname . '%');
}
// find
$users = $this->Users->find('all', array('conditions' => $conditions));
// set
$this->set(compact('users'));
}