Really has nothing to do with JavaScript.
You just need an HTML <form> that you submit to the server and then let the server do all the work.
So decide what kind of server-side code you will use (PHP/ASP/JSP/ASP.NET) and then post in the correct forum.
BUT...
First look here:
http://www.codingfourms.com/rules.htm
and look at rule 1.5
Nobody is going to write your code FOR you. You have to make a REAL effort at writing it and then just ask for help when you have problems.