Fix javascript

you need to validate what the javascript sends to the php, or else you will get hacked 
It's better to use getElementByID or class name or something. This selection method is very vunurable to breaking if you restructure the HTML, I.E if you wrapped the form in a <div> it will break these selectors.