msoa
August 2, 2013, 7:47pm
1
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?
d3rick
(Sebreuse)
August 2, 2013, 9:05pm
2
msoa:
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’]
msoa
August 3, 2013, 10:30am
3
$_POST is used to retrieve form values, not to set them.
Maybe you should read : http://www.w3schools …hp/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.