Automatic requery

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I'm sure I'm missing something simple here; help will be appreciated.

I've got a search form that displays records from a MySQL db matching
criteria entered by the user; the search form appears again below the
results. Each row of the recordset is shown with edit and delete links,
which call other .php pages (one for editing, one for confirmation of
the delete). All that works fine.

The edit and delete-confirm pages have links to return to the search
results, using javascript:history.go(?). This also works fine.

Trouble is, the edit or deletion is (of course) not reflected when the
user returns to the search results.

Ideally, the "return to search results" links would automatically
requery the db before showing the results. The only way I've found to
do that is to preserve the user's entries in the form, which would be
kinda handy anyway since it would make for easier refinement of the
search -- but if I do that, my "Reset" button doesn't work; the form
continues to show the user's previous entries.

What am I missing?

Re: Automatic requery

*** escribió/wrote (9 Sep 2006 18:58:51 -0700):
Quoted text here. Click to load it

Tell the browser the page must not be cached:

header('Last-Modified: ' . gmdate('D, d M Y H:i:s', time()-86400*365*10) . ' GMT');
header('Expires: ' . gmdate('D, d M Y H:i:s', time()-86400*365*10) . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', FALSE);
header('Pragma: no-cache');

I'm not 100% sure but this may help.

-+ - Álvaro G. Vicario - Burgos, Spain
++ Mi sitio sobre programación web:
+- Mi web de humor con rayos UVA:

Re: Automatic requery

Thanks, Alvaro, but I'm told that approach isn't reliable because not
all browsers recognize those tags. However, I did have an idea in the
middle of the night (sad, I know) that actually works: I changed the
reset button to a second submit button. The form's action reposts the
page, and the code already tested for the *actual* submit button before
doing the search -- so now my second submit button just reposts the
page, without search results and with a cleared search form.

Thanks again, though, I appreciate the idea.

Alvaro G. Vicario wrote:
Quoted text here. Click to load it
. ' GMT');
Quoted text here. Click to load it
Quoted text here. Click to load it

Site Timeline