php - How to look at _POST values coming to the controller (Yii) -


i read book "yii", can't understand how @ global _post array receiving controller?

view _form.php

<div class="row">         <?php             echo $form->labelex($model,'category_id');             echo chtml::dropdownlist('page[category_id]','', category::allcategory(),                 array(                 'ajax' => array(                 'type'=>'post', //request type                 'url'=>ccontroller::createurl('subcategory/dynamicsubcategories'), //url call.                 //style: ccontroller::createurl('currentcontroller/methodtocall')                 'update'=>'#page_subcategory_id', //selector update //                'data'=>array('category_id'=>'js:this.value'),                 //leave out data key pass form values through             )));            echo $form->error($model,'category_id');          ?>         </div>          <div class="row">         <?php             echo $form->labelex($model,'subcategory_id');             echo chtml::dropdownlist('page[subcategory_id]','', array());             echo $form->error($model,'subcategory_id');             ?>         </div>      <div class="row buttons">         <?php echo chtml::submitbutton($model->isnewrecord ? 'create' : 'save'); ?>     </div> 

subcategorycontroller.php

public function actiondynamicsubcategories() {         $data = subcategory::model()->findallbyattributes(array('category_id' => $_post['category_id']));         $data = chtml::listdata($data, 'id', 'title');         foreach ($data $value => $name) {             echo chtml::tag('option', array('value' => $value), chtml::encode($name), true);         }     } 

i'm interested in value view echo chtml::dropdownlist('page[category_id]','', category::allcategory(), ... comes controller subcategorycontroller.php?

at top of controller can output $_post array.

e.g.

print_r($_post); 

or

var_dump($_post); 

this should show post values.


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -