Set The $_Post Variables In View With Accessibility In Controller

Hi,

In view i have following code:




<?php  echo CHtml::beginForm() ?>

	<?php echo CHtml::textField() ?>

	<?php $_POST['delete']='1' ?>

	<?php echo CHtml::submitButton('Delete') ?>

<?php  echo CHtml::endForm() ?>



But in Controller the $_POST[‘delete’] not exist on var_dump(’$_POST’).

How can properly set the $_POST variables in View so that the variables accessible in the Controller?

$_POST is used to retrieve form values, not to set them.

Maybe you should read : http://www.w3schools.com/php/php_post.asp or just try to set up a form and retrieve the values with PHP first to understand how it works. Then use Yii.


<input type="hidden" value="1" name="delete"/>

The you could retrieve this field with $_POST[‘delete’]

I use the same way. I wondered here.