Hi Guys,
I have two CHtml::submitButton() in my form, namely "Accept" and "Reject". Each of the buttons has a specific ID … When any of the two are pressed, i would like to trigger an action in my controller. Below are the code snippets.
==============================================================================================================
View
<?php
echo CHtml::beginForm(‘mycontrollerName/AcceptUserRegistration’,‘get’);
?>
<?php echo CHtml::submitButton('Accept', array('id' => 'accept')); ?>
<? echo '&nbsp;&nbsp;&nbsp;'; ?>
<?php echo CHtml::submitButton('Reject', array('id' => 'reject')); ?>
<?php echo CHtml::endForm(); ?>
==============================================================================================================
[b]Controller
[/b]
public function actionAcceptUserRegistration() {
$value = $_GET['id'];
if($value == "accept"){
//will do something here
}
if($value == "reject"){
//will do something here.
}
}
=============================================================================================================
When i implement it this way. the get value in the controller side is empty. What I’m I doing wrong? Or is there any other way around this?
Regards
Yii-fan