A couple of things about it, first like I said I was just testing to see if is possible to do it solely php and just did this on my local server. If was going to put it on the internet I would sanitize my variables first and lastly I wouldn't don't it all in php for while php is good for pulling information from the server. JavaScript (even Flash) is better for the client side of things.