faqts : Computers : Programming : Languages : PHP

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

11 of 37 people (30%) answered Yes
Recently 6 of 10 people (60%) answered Yes

Entry

How can i sort asc, thereafter desc by click on the same button (like in excel)

Nov 27th, 2008 05:08
healthy man, dman, Kim, jello j, http://www.ttnr.org


You can pass a parameter in the URL.
Example 1: (you will probably have more parameters):
http://.../display.php?sort=desc
In the PHP script you then check for the value of sort, and generate 
the button, but this time with the url:
http://.../display.php?sort=asc
You can check the value using $HTTP_GET_VARS["sort"] or $HTTP_POST_VARS
["sort"] if you posted to the script from a form.
Example 2:
If your script is http://foo.bar.com/script.php and the browser 
connected to the following url:
http://foo.bar.com/script.php?show=1&sort=desc
$HTTP_GET_VARS["show"] would be set to "1" and $HTTP_GET_VARS["sort"] 
would be set to "desc".
More info: 
http://www.php.net/manual/en/language.variables.predefined.php
http://www.healthbyhealth.com
http://www.healthment.com
http://www.mesotheliomadown.com
http://www.mesotheliomaout.com
http://www.pickarticle.com