php - passing a variable using chmtl text field and button -
i'm trying create text box , button. when button pressed, input in text box passed next view. far, i've been able write this:
echo chtml::textfield('text'); echo chtml::button('submit',array('submit' => array('site/result')));
which pretty plain button , text field. on should add code? , also, how retrieve passed data in other view?
modify view code
<?php $this->beginwidget("cactiveform",array( 'id'=>'new_view_action', 'action'=>array('site/result') )); echo chtml::textfield('text'); echo chtml::button('submit',array('submit' => array('site/result'))); $this->endwidget(); ?>
in site controller result action
class sitecontroller extends ccontroller { .... public function actionresult(){ if(isset($_post['text'])){ $text = $_post['text'] ; // logic based on text value $this->render('secondview',array('attributes'=>$attributes)); } } }
Comments
Post a Comment