About the easiest way to do this is using Ajax and json on the construct side. You'll need some sort of server to send and receive your json data and to communicate with the mysql server.
What you're asking for is not a simple, here you go, 2 lines of code. I've done this myself in php. There's lots of things to consider when making a user registration system.