Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

How to get params from url using <a href='' ''>

Hi! This time i want id value from url, but i can't see nothing.

My href is:

<a href="/cursoscompra?idcurso=<?php echo $disp['idcurso'] ?>" id="url_compra" class="text-default"> <?php echo $disp['nombre_curso'] ?></a>

Controller:

public function indexAction() { $idcurso = $this->dispatcher->getParams('idcurso'); $curso = Cursos::findFirst(array("idcurso = :idcurso:", 'bind' => array('idcurso' => $idcurso))); $cursos=$curso->toArray(); $this->view->curso = $curso; }

And finally view CursosCompra index:

<h3 class="panel-title"><?php echo $cursos->idcurso; ?><a class="heading-elements-toggle"><i class="icon-more"></i></h3>



27.1k
Accepted
answer

You have a little mistake use $this->dispatcher->getParam('idcurso'); insteand of $this->dispatcher->getParams();

Good luck

Eagle eye!! :)

Thanks very much!