Achilleas:

The only way I can see to do this is use either:

* GET variables (passed in the URL's query string)
* Sessions
* Cookies

The first one is the easiest to do, I wouldn't worry about "ugly" query
strings, if it works it works, and no-ones gonna want to freak the URL
of their own search results are they? - even if they do, you can have a
default screen that takes them back to the initial search page. You
could then use the form method GET instead of POST in the actual search
page, then break-up the resulting $_GET[] or $HTTP_GET_VARS[] array
(depends on which PHP version you use) and include these array elements
in hyperlinks or as hidden field values in another form, whichever
method you use to allow users to re-order the results.

There is a limit though on the length of query string you can use,
something like 256 characters I think.

Session would be OK too, and fairly simple to deploy, just make sure you
kil off the session each time a new order instruction is given.

I havn;t used cookies yet, so consult php.net for that one, but I would
have thought that a little overkill! ;-)

HTH :-)
Russ






-----Original Message-----
From: Achilleas Maroulis [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 28, 2002 7:36 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Reload the page without losing variables


Hi. 
I have a little problem concerning passing variables or reloading the
page.

I have a search fom page (search.php) which POSTS some variables to
another page displaying the results (results.php). What I want to do is
to let the users change the order of appearance in the last page. I
thought I should use a variable named $order and put it into the select
string like this:

SELECT fields... FROM tables... WHERE expresions ORDER BY $order ASC

and then make a link of the header of each column like this:

<a href=\"results.php?order=HEADER_NAME\">HEADER_NAME</a>

This would force the page to reload with a new order of appearance of
the results but if I do this I will lose all the other variables that
came to this page by the previous form.
I wonder if there is a better  way to refresh the page, without losing
my variables, than using sessions or by sending again all my variables
through the url (it would become too big and ugly...)

With a great respect to this list (it has helped me alot in the past),
Achilles 

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to