jesus, how many times will this have to be said?
PHP IS A SERVER-PARSED LANGUAGE, MEANING THAT ALL PHP CODE IS "COMPILED" BY THE SERVER, WHICH IN TURN ONLY RETURNS HTML TO THE CLIENT.
JAVASCRIPT IS A CLIENT-SIDE LANGUAGE, MEANING THAT IT IS PROCESSED BY THE CLIENT BROWSER.
you must use javascript (or vbscript/etc) for this sort of thing.