Search code examples
phphtmlhref

Is it possible to pass two parameters via href?


I need to send two kinds of information from view to controller.

This is how my href looks like:

<a href="editBenefit/1}" class="btn blue">Modificar</a>

This is sending to my php function the parameter 1, but let's say I have to send another parameter in that function, something like:

<a href="editBenefit/1/2}" class="btn blue">Modificar</a>

And my php function looks like:

function editBenefit($id, $option = '')

because parameter 2 won't always be sent. Like this, it's not working and I would like to know if this is possible or not in order to move on.

Thanks in advance.

EDIT:

Yes, it's possible to send two parameters like: editBenefit/1/2 like @JohnConde said.

I was just having some lame mistake from the wrong template to the right function.


Solution

  • editBenefit/1/2 is a valid URI so that should work. If it doesn't then it is a coding issue on the receiving end.