If you're OK with changing the current browser page, then you can either do a form submission (where the form elements will contain the data to be sent to the server) or you can just create an URL with all the data encoded in the query parameter on the URL and set window.location = newURL;
. That will send that GET request to the server, the server can process off the query parameters and then decide what result to show the user on the new page.
Assuming, you don't to change the current browser page, then from the client, you call the server with an ajax function written in javascript and pass the data with the ajax call. On the server, you field that request, extract the data from the request and process it into your database.
If you want examples, there are lots of examples of code on the web. Just search for "ajax javascript" and there are thousands of examples. I'm looking for a good representative StackOverflow answer to point you to or mark your question a dup of, but haven't found one yet so I'm steering you in the right direction with this answer for now.
Read here first on MDN: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Using_XMLHttpRequest as a good general reference on Ajax.
Then, here's a simple function in plain javascript for making an Ajax call:
How to make an AJAX call without jQuery?
There here's are several simple plain javascript references on Ajax:
http://www.degraeve.com/reference/simple-ajax-example.php
http://www.htmlgoodies.com/beyond/javascript/article.php/3767776
http://www.ryannedolan.info/teaching/cs4830/examples/ajax-examples
http://www.javascriptkit.com/dhtmltutors/ajaxgetpost.shtml
Though you didn't mention a cross-browser library in your question, many libraries just as jQuery include a lot of helpful code for managing AJAX calls.