I have an HTML form with a hundred or so elements on it, used for searching
When the user submits the form (via GET) the URL is loaded with ALL of
these fields, and many of them are not even actually used in the search
don't have any value in them and just distill this down to the
elements/keys that the user actually entered some input for? ie. defaulting
all the rest to 'blank'.
In PHP, this would look something like this:
foreach ($_GET as $k => $v) if ($v == '') unset($_GET[$k]);
The problem as I see it, is that this "magic" happens when the user hits
"Submit", so not sure PHP has any way to intercept at that point.
"onSubmit" I suspect. But this seems like something that someone should
have solved before and common enough that I would think Apache could handle
it transparently with a directive or module enabled so I don't have to code
some hack on every page.
I guess I could always redirect to some 'scrubber' page that strips them
out and redirects on to the refering page again, but that seems klunky.
BTW, I want to use GET so that the page can be bookmarked for future
searches of the same data (or modified easily with different dates, etc.),
so that's why I don't use POST.