Iam trying to pass variable along with Chtml button in Yii using the following code

 echo CHtml::button('Update', array('submit' => array('serviceRequest/Update',array('id'=>$requestId))));

But it is showing 404 error due to the url problem. On clicking some dummy characters is getting added to the "id" .
On clicking the button Iam getting the following url. ../serviceRequest/Update/0%5Bid%5D/4 . How to remove this special characters and how can I get the correct url as ../serviceRequest/Update/id/4 . I need button itself there..
Thanks in advance

有帮助吗?

解决方案

Use

array('submit' => $this->createUrl('serviceRequest/Update',array('id'=>$requestId)))
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top