Help About Chtml Button And Text Field

im trying to create a text box and a button, and when the button is pressed, the input in the text box is passed to the next view. so far, ive been only able to write this


<?php echo CHtml::textField('text'); 


echo CHtml::button('Submit',array('submit' => array('site/result')));



which is pretty much just a plain button and text field. any help on what should i add to my code?

You can use javascript onClick event for getting textbox value.

Also you can use CHtml::submitButton instead of CHtml::Button. When you use Submit button, you will get value in $_POST array in your actionResult() function in siteController.

Please give ID to your textbox so it is easier for you to fetch data from ID.