Question

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

Was it helpful?

Solution

Use

array('submit' => $this->createUrl('serviceRequest/Update',array('id'=>$requestId)))
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top