User Registration Form using PHP 7.1.5


The first step would be to create a new MySQL database and then add a user with all privileges except GRANT. Now replace the values in the file db_connection.php with those.

$link = new mysqli("localhost","user-name","user-password", "your-database-name");

Now once you are done with this run the file createTables.php from the browser. You should see a success message. If not make sure you have entered the right credentials and that MySQL server is running.

Now, if you don’t have a registration form UI (HTML5+js) then you can use postman from the chrome web store or any other testing tool.

You can use the following JSON to post to userRegistration.php

"fname": "Shiva",
"lname": "Charan",
"email": "",
"gender": "m",
"pwd": "Password"

This should give you a success message when executed once and you should see the row added to your database in your PhpMyAdmin. If executed more than once, then you will get a message “User already exists”.

Note: Make sure that you have PHP 7.1.5 installed. This program works on HHVM as well.