] is your friend!
No matter what, you will have to handle the database interactions in the server side, i.e. using PHP.
But, forget everything and read that tutorial I gave you, (if you don't know about Ajax, of course). And you'll find a way doing it then.