Hi all. I downloaded CodeIgniter yesterday for a trial and, after a three or four hours of use, I have already come across this $_GET issue. First of all, many thanks to Al James for his solution, which seems to work well for me after a quick check.
I would like to try to throw some light on why some of us feel it an important feature to add or, rather, never to have been removed. My opinion, in short, is that clean URLs are desiderable in every web app, but they have a limit.
I think the perfect example to illustrate my point is a search engine. Say you have a form where you can enter a series of arguments and, after clicking “Search”, you will be shown a series of results. For usability’s sake, it’s expected that this search can be reproduced by just copying&pasting;the results’ URL to another browser.
In the web apps world, there are two ways of doing this: the one used by this forum, and the one I prefer
The first way is: make a POST request with the arguments, and then redirect to a page where these are somewhat encoded into the clean URL. In the case of searches within this specific forum, it seems a sort of hash is generated, linked to the search arguments, stored both on the DB, and then inserted as a URL segment. This URL with the hash on it can be later used again… or not, because I just realised I cannot use it on a different browser. I guess it’s stored on the session variable instead of the DB, but let’s assume it works and can be reused, as it’s fixable thing. The URL will look something like:
http://codeigniter.com/forums/search_results/9a708abce50301c47e3212cbea9b13d1/
The second way is: use a GET request. (<form action="search" method="get">). In this case, the URL would (hypothetically) look something like:
http://codeigniter.com/forums/do_search/?XID=07662a5ac1dd86bff27997d1a6e554c0c5f44ef7&board_id=2&site_id=3&keywords=get&search_in=all&search_criteria=all&forum;_id[]=all&member;_name=&member;_group[]=all&date=30&date_order=newer&order_by=date&sort_order=desc
In the first approach:
- The process to execute the search is a bit more complex (involves a redirection and, in the case of the specific example above, storing the parameters along with the hash on the DB).
- The URL is not really that clean, as the hash has no semantic value.
- The redirection puts the results one request farther. This is undesiderable both in terms of user time and bandwidth use.
In the second approach:
- The URL is very long and ugly.
- The URL is self-explanatory, for both users and machines.
- The URL is a natural permalink.
- The results are only one request away.
In my opinion, the advantages of the second option overcome the drawback of the ugly URL for this specific case.
Additionally, on the documentation, security is named as a reason for this obliteration of the GET parameters. This strikes me as a weak reason, as POST parameters may be forged the same was GET parameters are. Not as easily as GET parameters, sure, but still, assuming that ones are safer than others sounds to me like a false sensation of security. I think GET arguments should be treated as equals of POST arguments, and be given a similar function to access them.
I hope I have been clear. Please excuse my imperfect English, and thanks for reading this far!
