How to retrieve an url parameter in the Zend Framework ?

Posted by ismaelsow on Stack Overflow See other posts from Stack Overflow or by ismaelsow
Published on 2010-04-06T10:07:12Z Indexed on 2010/04/06 10:13 UTC
Read the original article Hit count: 231

Hello guys !

I'am trying to retrieve an parameter passed in a url using the zend framework. But of course, it is not working ! My code looks like this :

Generating the url :

<?php echo $this->url(array('controller' => 'poll', 'action' => 'showresults', 'poll_id' => $poll['_id']), null, true) ?>

Retrieving the "poll_id" parameter in showresultsAction() :

 $request = new Zend_Controller_Request_Http();
 $poll_id = $request->getParam('poll_id');

The problem is that $poll_id is NULL. When I do a var_dump of $request->getParams(), it is also NULL. I have glanced trough the Zend Framework doc, but it was not very usefull. Any idea ? Thanks !

© Stack Overflow or respective owner

Related posts about php

Related posts about zend-framework