We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

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 https://jsfiddle.net/joL8558n/



14.9k

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.