Allow check for POST variable.

This pull request adds a nice check for whether or not `$_POST['q']` is set. In normal circumstances, this code would work correctly; however, due to Murphy's law, if something can go wrong, it will.

An easy way to see how this can be useful is if someone creates a nice HTML form, method of POST, towards the software. It will go along this first `if` statement because the request method is POST - however, the POST variable is not set, therefore it would create errors in the code.

Errors aren't good.