Created
September 14, 2014 05:02
-
-
Save taleeb35/c38dd28d5bb1e30c43d3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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