That will be it. Your GET request is in a branch of your POST. The only way it'll be set is its passed on your form action. Its a set variable, but without the echo its empty.
Alternatively you can pass it through a hidden input and retrieve from post.
As of PHP 5.5, the MySQL library has been officially deprecated. It is recommended to move to either MySQLi or PDO libraries for your mysql connectivity. See here for help choosing which interface you prefer: http://php.net/manual/en/mysqlinfo.api.choosing.php