this is not necessarily a defect in the code.
not all pages will have a query string passed in.
Not all pages that do have a query string passed in will require that the query string be passed with the form submission.
in actual fact server issues can arise from automatically assuming that the query string passed in should be included in the forms action. it's better to add the code that I posted for you on an as needed basis rather than automatically use it on every form, where it will only be needed in a small number of cases.