Set the form action to:
action="<?php echo (htmlentities($_SERVER["PHP_SELF"]));?><?php echo(isset($_SERVER['QUERY_STRING'])?"?".str_replace("<","%3C",str_replace(">","%3E",str_replace('"',"%22", $_SERVER['QUERY_STRING']))):""); ?>"
that should do the trick.