I don't completely agree with FirefoxRocks, because despite the fact that hidden fields can be useful at the same time can be exploited by an attacker. If used, it is best to use them in forms with the POST method and do the validation on the server side.
@magiccode9: your code is fine, but i recommend to do a quick search on the forums because i know that there are a lot of topics related to this subject. For example these are some topics that can be helpful:
@Bermuntas: you are welcome.
Best regards,
Comment/Reply (w/o sign-up)