How to pass parameters from view to an action in controller
result[$i]['id'].""; ?>">"Edit this Promotion"
Here "editpromotion" is the action to which I wish to pass the parameter:"$this->result[$i]['id']".
And in the controller action('editpromotionAction') :
I am using :
$pass = $this->getRequest()->getParams();
$this->view->pass = $pass;
But the Output I am getting:
"array 'controller' => string 'index' (length=5) 'action' => string 'editp开发者_StackOverflow中文版romotion' (length=13) 'module' => string 'default' (length=7)"
And can't see the parameter passed.
Please tell me where I am wrong and please specify me a solution for this Problem.
Thanks in advance
You should configure the router, or use different link style (add id
param):
<a href="<?php echo "editpromotion/id/".$this->result[$i]['id'].""; ?>">"Edit this</a>
or even better:
<a href="<?= $this->url(array('module'=>'default', 'controller'=>'index', 'action'=>'editpromotion', 'id'=>$this->result[$i]['id']), null, true); ?>">Edit this</a>
精彩评论