If you read the manual, you will see that you cannot set a cookie AND read it's value on the same request. ( http://php.net/set_cookie )
[INDENT]Once the cookies have been set, they can be accessed on the next page load with the $_COOKIE or $HTTP_COOKIE_VARS arrays.[/INDENT]
Also, as rowan states, there are some security issues with your code anyway, and would be well advise to rethink the use of cookies here in favor or sessions.
HTH.