tags:

views:

58

answers:

1

I have a hyperlink with a query string like cgi-bin/filename.cgi?sort=ASC. When I click this link I want it to change its value to cgi-bin/filename.cgi?sort=DESC. And again when I click the link then it should go to its original query string state. Is it possible?

I had posted the same question previously, got an answer also which I have marked as accepted because I found that Jquery tablesorter solved my problem, but now there's a slight modification and I have been told to do it using the query string.

+2  A: 

You're not changing the query string. Each time you sort your data, you're creating a new request to your script. When you use "sort=ASC" then the script's output should provide a link for "sort=DESC" and vice-versa.

ishnid
As i was surfing, i got to go through an article which stated that "hash value in query string can be changed" not the "query string". Can anybody give me somemore explanation about this chunk of information
sonya
Read through http://perldoc.perl.org/CGI.html for information on handling query parameters.
Robert Wohlfarth
i went through the link and found a syntax $query = CGI->new("new $query to be inserted"); . I palced this piece of code to change the value of query string i.e $query = CGI->new("sort=Desc");.But When i gave the print $query; , then it gave me this value "CGI=HASH(0x152a50c) ".I did not get the reason behind this?Did i give the wrong syntax or gave the syntax at wrong place ..! No idea what to do. Please do guide me.
sonya
You don't seem to be very clear about what you are trying to do where. Your Perl is running on the server, not the client, so _anything_ you do in Perl can only affect what the user sees when they do another HTTP request (either a full one, or an Ajax call). If you want to change something on the page in the client, before sending a request, you have to do it with a client-side language, i.e. Javascript.
Colin Fine