In my form, I'm trying to pass the following values to a MySQL query.
For some reason the MySQL totally ignores the values posted and does not order the data. Here's what I have in the php page that the values are posted to.
I believe it has to do with the commas in the value string, but I'm not sure. I'm using MySQL 5.0 and PHP 5.1.4.
Any suggestions would be appreciated. Thanks.
Code:
Sort by:
<select name="sort" type="text">
<option value="Title, Author">Title</option>
<option value="Lexile, Title">Lexile</option>
</select>
Code:
$sort = $_POST['sort'];
$query = "SELECT Title, Author, Lexile, School FROM booklist ORDER BY ('$sort')";
Any suggestions would be appreciated. Thanks.