We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

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.

form action to clean url from select

This is probably stupidly simple, but I'm having trouble with it.

I'd like to use a select list in a form to go to a url:

<form method="get" action="dir/view/">
<select name="id">
    <option value="12">Component name here</option>
</select>
<input type="submit" value="Go" />
</form>

I'd like the form to go to dir/view/12, etc., not dir/view/?id=12. What's the best way to accomplish this?

Thanks!



6.4k
Accepted
answer

Javascript, you can do this in several ways, e.g http://jsfiddle.net/joL8558n/



14.8k

Yeah -- I was hoping there was a non-js way of doing it, but couldn't find any, apart from a dispatcher redirect behind the scenes.

Thanks.