Javascript and Onclick problem

Don’t use onclick on a submit button. You should be triggering the submit event on the form instead of the click event on the submit button in order to run processing before the form is submitted.

Note also that the form will be submitted automatically when the code is run so there is no reason to submit it from the JavaScript.