After developing your application, it's time to setup a signup page where user can fill a form and submit before they will have access to protected website.
Test connection as a mysql user of database
First, Let's assume you have access to mysql database. we will test connection to database, once we can connect to database, we are good to go. If you look at our code below it's almost already made you can just copy and paste and start testing. Save it as dbconnect.php and run it.
Create a new database where we can run testing
In below code, our code has been written in place you can copy and paste and start testing. The below code will help us create database with name 'webdesign' after running that code we will have good ready for use database. Save the code as dbcreate.php and run it.
Creating table in database we created earlier
In previous database we created, now let's create table where we will store user profiles. The code below has been written and ready for testing. You can write it manually or copy and paste. Copy, paste and save the code as createtabele.php. Now, if you run the below code this will create table with name 'profiles' for you.
The HTML page for our signup ready for testing
The html tag below has been fully packaged, you can write it manually or copy and paste to your html document after pasting, remember to save it as signup.php and run it to see the output of a cool structured signup page ready for user input.
The php script for users so they can submit their details to our database
In our script below, we have prepared a cool php script to submit user profiles to the database, the details include: (image, fullname, fulladdress, emailaddress, phonenumber, username, password, project, subscription, gender) it's super cool you can copy and paste, but remember to paste on top of your html file and save it as signup.php and run it. Also remember to create a folder where the profile picture will be store, such as C:\xampp\htdocs\image then start filling the form, after filling the form just click "Submit", if everything goes well you won't see error messages from php, but if there is you must see atleast one.
Testing our signup page now
In the above code, point your browser to http://localhost/signup.php fill that form correctly and submit, you will see a success messages indicating that the registration was successful.
Let's view the details we submitted to the server. Now, copy the code below, paste and save it as profile.php point your browser to the file: http://localhost/profile.php and run it. This will retrieve our profile details. If you have written all the above code correctly I think it's error free, but if the above code spot error don't hesitate to get in touch so that we can review the code.
'.$row["id"].'
'; ?> '.$row["fullname"].''; echo ''.$row["fulladdress"].'
'; echo ''.$row["emailaddress"].'
'; echo ''.$row["phonenumber"].'
'; echo ''.$row["username"].'
'; echo ''.$row["password"].'
'; echo ''.$row["project"].'
'; echo ''.$row["subscription"].'
'; echo ''.$row["gender"].'
'; echo ''.$row["reg_date"].'
'; } } else { echo "0 results"; } $conn->close(); ?>Summary
If you have followed the above tutorials carefully, you will make a good signup page. Although not the best signup page in the world, but a good signup page that will earn you a good level as application developer. Thanks for reading this article. if you have a question submit them on commentbox. Thank you.
Comments