shajal_8015
(Shajal Chandra Bala)
January 14, 2013, 11:26am
1
How to multiple parameter pass as post by using CHtml::link and get parameter value from controller action ?
Like as
$url = array(‘Exams/displaySubject’);
echo CHtml::link(
$val['exam_groups_name'], $url, array(
'submit' => $url,
'params' => array('exam_groups_id' => $val['exam_groups_id'], 'batch_id' => $val['batch_id']),
)
);
But i can’t understand is it working ? Because I can not get parameter value in controller action. if it is right code then how to get parameter value from controller action ? So help any one plz. solve the problem ?
seenivasan
(Chellamnivas)
January 14, 2013, 1:16pm
2
Dear Friend
I am finding no problems.
I just give my logic.
views/test/one.php
echo CHtml::link("submit",array("test/three"),array(
'submit'=>array("test/three"),
'params'=>array('name'=>'seenivasan'),
));
TestController.php
public function actionThree()
{
echo $_POST['name'];
}
alirz23
(Ali Raza)
January 14, 2013, 3:18pm
3
I have tested your code it works fine
<?php
echo CHtml::link($val['exam_groups_name'], $url, array(
'submit' => array('Exams/displaySubject'),
'params' => array('exam_groups_id' => $val['exam_groups_id'], 'batch_id' => $val['batch_id']),
));
?>
shajal_8015
(Shajal Chandra Bala)
January 16, 2013, 6:38am
4
Dear Friends ,
Thanks for reply. I had another problem. Now it is working.
seenivasan
(Chellamnivas)
January 16, 2013, 6:45am
5
Dear Friend
You are not having any controller named TestController.
Try The following.
echo CHtml::link("submit",array("test/three"),array(
'submit'=>array("monthlyPayslips/three"),
'params'=>array('name'=>'seenivasan'),
));
prgcoder
(Prgcoder)
June 26, 2013, 4:43pm
6
Hi Saimon,
I am having problems with reading the POST variables in my controller and would appreciate it if you could share some of your code from the "displaySubject" function.
Thank you.
Regards,
Andy.