1

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

anu
  • 458
  • 2
  • 13
  • 36

1 Answers1

1

Use

array('submit' => $this->createUrl('serviceRequest/Update',array('id'=>$requestId)))
Pranav 웃
  • 8,469
  • 6
  • 38
  • 48
veelen
  • 1,916
  • 19
  • 26
  • On applying the above change the url now showing is ../ServiceRequest/Invites">serviceRequest/Update – anu Dec 24 '13 at 09:56