Why NOT use POST method here?
- by Camran
I have a classifieds website.
In the main page (index) I have several form fields which the user may or may not fill in, in order to specify a detailed search of classifieds.
Ex:
Category: Cars
Price from: 3000
Price to: 10000
Color: Red
Area: California
The forms' action is set to a php page:
<form action='query_sql.php' method='post'>
In query_sql.php I fetch the variables like this:
category=$_POST['category'];
etc etc...
Then query MySql:
$query="SELECT........WHERE category='$category' etc etc....
$results = mysql_query($query);
Then I simply display the results of the query to the user by creating a table which is filled in dynamically depending on the results set.
However, according to an answer by Col. Shrapnel in my previous Q I shouldn't use POST here: http://stackoverflow.com/questions/3004754/how-to-hide-url-from-users-when-submitting-this-form
The reason I use post is simply to hide the "one-page-word-document" long URL in the browsers adress bar.
I am very confused, is it okay to use POST or not?
It is working fine both when I use GET or POST now... And it is already on a production server...
Btw, in the linked question, I wasn't referring to make URL invisible (or hide it) I just wanted it too look better (which I have accomplished with mod_rewrite).
UPDATE:
If I use GET, then how should I make the url better looking (beautiful)?
Check this previous Q out:
http://stackoverflow.com/questions/3000524/how-to-make-this-very-long-url-appear-short