You might want to indent the code inside your control structures. This makes code much easier to read and understand. It's good to see that you've began commenting your code. This is important from day. It may be obvious to you what your code does, but to someone else, it might be a whole load of blah.
Are you using a version of PHP older than 4.1.0? If so, then your code is fine, but if you are using a newer version of PHP then please use $_GET instead of $HTTP_GET_VARS.