register successfully message

register successfully message is the notification to let users know that they should do next. It can be the notification that you have completed the task and now you could log in and use this page. Or it can notify that you successfully registered but you need to update more personal information.

Displaying this notification is quite simple for people who are specialized in programming language. It is the process of entering information into the database and displaying a notification if successful.
The notification content, depending on each source code and its purposes, is different. In this example, we will display the notification on PHP source code.
In this example, register successfully message is just “You have registered successfully”.

If you use Shopify, you can see how complicated it is. I feel that it is much easier when I use form builder app. To create a contact form on Shopify, I just need to drag and drop. If you are interested in this app, you could get access to this link

Preparation

– prepare hosting or install localhost, you could use xampp to install

– use editor such as notepad++, phpdesigner, etc.

Implementation

Create a database which name is register. You could use the following code to create a database quickly.

CREATE DATABASE IF NOT EXISTS `register` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;

USE `kungfuphp`;

 

CREATE TABLE IF NOT EXISTS `users`(

`id`int(11) NOT NULL AUTO_INCREMENT,

`username`varchar(30) NOT NULL,

`password`varchar(30) NOT NULL,

`name`varchar(255) NOT NULL,

`email`varchar(255) NOT NULL,

PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;

 

Here is the entire code content including form, database connection as well as successfully-register notification.

<html>

<head>

</head>

<body>

<?php

$conn = mysqli_connect(‘localhost’,’root’,”,’register’) or die(“cannot connect to database”);

mysqli_query($conn,”SET NAMES ‘UTF8′”);

if (isset($_POST[“btn_submit”])) {

$username = $_POST[“username”];

$password = $_POST[“pass”];

$name = $_POST[“name”];

$email = $_POST[“email”];

if ($username == “” || $password == “” || $name == “” || $email == “”) {

echo “Please enter your infomation”;

}else{

$sql=”select * from users where username=’$username'”;

$kt=mysqli_query($conn, $sql);

 

if(mysqli_num_rows($kt)  > 0){

echo “Account is exits”;

}else{

$sql = “INSERT INTO users(

username,

password,

name,

email

) VALUES (

‘$username’,

‘$password’,

‘$name’,

‘$email’

)”;

mysqli_query($conn,$sql);

echo “you have registered”;

}

}

}

?>

<form action=”#” method=”post”>

<table>

<tr>

<td colspan=”2″>Form register</td>

</tr>

<tr>

<td>Username :</td>

<td><input type=”text” id=”username” name=”username”></td>

</tr>

<tr>

<td>Password :</td>

<td><input type=”password” id=”pass” name=”pass”></td>

</tr>

<tr>

<td>Full name:</td>

<td><input type=”text” id=”name” name=”name”></td>

</tr>

<tr>

<td>Email :</td>

<td><input type=”text” id=”email” name=”email”></td>

</tr>

<tr>

<td colspan=”2″ align=”center”><input type=”submit” name=”btn_submit” value=”register”></td>

</tr>

 

</table>

 

</form>

</body>

<style>

 

form{

width: 300px;

margin: auto;

margin-top: 112px;

border: 1px solid #cdcd;

padding: 10px;

}

 

</style>

 

</html>

Now, you try running the code to see the result

In the database, data is displayed as below

The issue register successfully message is so easy. You could make your own simple registration before reading my guide. Building a form in some other source codes wastes time, and requires complex tasks and security.

Enjoy this blog? Please spread the word :)