So all the js does is populate the <input>? If it does that, then there is no problem with js. PHP doesn't care in the least how the data got in there. All it cares about is what was sent with the form.
I looked at the file, and the formatting is a mess. Go through and post 2 portions only: the form from <form> to </form> and the PHP that processes it. Please place both sections between [ php ] and [ /php ] tags (sans spaces).