Skip to content

Instantly share code, notes, and snippets.

@taleeb35
Created September 14, 2014 05:02
Show Gist options
  • Save taleeb35/c38dd28d5bb1e30c43d3 to your computer and use it in GitHub Desktop.
Save taleeb35/c38dd28d5bb1e30c43d3 to your computer and use it in GitHub Desktop.
<?php
App::uses('AppController', 'Controller');
/**
* Helps Controller
*
* @property Help $Help
* @property PaginatorComponent $Paginator
*/
class StatesController extends AppController {
var $helpers = array('Html','Js');
public function get_states() {
$country_id = $this->request->data['State']['country_id'];
$states = $this->State->find('list', array(
'conditions' => array('State.country_id' => $country_id),
'recursive' => -1
));
$countries = $this->State->Country->find('list');
$this->set(compact('states','countries'));
}
}
<div class="users form">
<?php echo $this->Form->create('State');?>
<fieldset>
<legend><?php echo __('Add User'); ?></legend>
<?php
echo $this->Form->input('country_id',array('empty' => 'Choose Country'));
?>
</fieldset>
<?php echo $this->Form->end(__('Submit'));?>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment