This is because you are using jquery mobile and that automatically submits forms with ajax and reloads the page without changing the url.
There are two options to fix this issue. I think the easiest (the one I already implemented) is to just add this to your <form> tag:
data-ajax="false"
The other option is to use absolute URLS for your links, so instead of:
<a href="grid.php?...
use:
<a href="/bmw/grid.php?
but that would require updating all of your links site wide. JQuery mobile doesn't work well with relative links and form submits when your files are in different directories.