You should never ever take user input and cram it into a query without checking it. Someone might enter "DROP DATABASE your_db"
And the error does tell you something. Your SQL syntax is wrong.
If this is a server facing the world, you might want to send these errors to a log file rather than echoing them to the screen. Also, you should check for errors. INstead of this:
$query = mssql_query($getquery);
Do this:
$query = mssql_query($getquery);
if (!$query) {
// write some code here to send error msg and query to a log file
die("There was a problem with the query");
}