Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Automatic requery
September 10, 2006, 1:58 am
rate this thread
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
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?
- Alvaro G. Vicario
September 10, 2006, 8:06 am
Re: Automatic requery
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);
I'm not 100% sure but this may help.
-+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
++ Mi sitio sobre programación web: http://bits.demogracia.com
+- Mi web de humor con rayos UVA: http://www.demogracia.com
Re: Automatic requery
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:
. ' GMT');