Probably not with PHP. PHP is a server-side language; to encrypt that word, you have to transmit it from the client to the server, which generally requires loading a new page (unless you want to get into using AJAX, which is overly complicated for this kind of page).
There's a number of Javascript implementations of the MD5 algorithm available on the web (just Google "Javascript MD5"). That's probably your best bet -- a Javascript function that reads the contents of the text box and encrypts it.