registration successful message in php

Today we will talk about registration successful message in php. Displaying a notification after a successful registration is extremely important because it lets us know whether our program works well or not. I also provide source code after this article. Therefore if you are not skillful in PHP or you want to edit this source code, you just need to download the code at the end of the article.

Registration successful message in php

PHP is a popular programming language that is loved by lots of people. It also is the language used to create many opening source codes such as Prestashop, Magento, WordPress, etc. PHP in general and source codes include the registration part. Registration successful message in php works depending on the process of the project. Today we give you a simple notification demo.

Preparation

  • Using hosting or server localhost, you could use xampp or similar software that you need.
  • Code editor software, you could use familiar software such as notepad++

Implementation

We start checking the data. During the registration process, if saving the information of the form to the database is successful, there will be a notification for customers to know they have completed registering. About the displaying content, it may be a thanking or others, you just need to edit texts.

Firstly, we create a database which I name “test”. We add table and fields to the database. If you hesitate to do this, you could copy the following code and paste it into sql.

CREATE DATABASE IF NOT EXISTS `test` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE `test`;
 
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;
<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>

You should input the right information so that the notification can be displayed. You could check in the database. Below is the written data. Because this is the demo, I do not encode the data. When you apply this to the practical project, you are provided with some functions to encode such as md5, sha, etc by PHP for the purpose of customers’ safety.

Registration successful message in php

We have finished the article which is about Registration successful message in php. The issues related to custom fields,create input, create recaptcha as well as form are interested by many people. PHP language and other programming languages newbies should pay attention to this issue.

date of birth in php form

How to use date of birth in php form is the issue that many people are confused when using this programming language. With the forms related to personal information, there are many cases that forms include date of birth information.

date of birth in php form

If we use textbox to input date of birth, data must be checked. If users enter text, special characters or a number bigger than 31, there must have a notification that the input is invalid. Commonly, we use javascript to process the data.

In order that users do not input text or special characters, you could use type=number limited from 1 to 31.

There are many systems using dropdown for the purpose of importing date. With dropdown, users do not have to enter information but choose one date in the list of dates displaying. It must be sure that data displays properly. For example, there is no 30th or 31th in February.

Using the types of input like the two above, you need to identify data and calculate properly as well. This will costs you a lot of time. There is one type that incurs less error but is more visible. It is date picker. Thanks to date picker, using date of birth in php form is not a big problem anymore.

You could use the following example to see if date picker can make your project simpler.

<!doctype html>
<html lang="en">
<head>
<metacharset="utf-8">
<metaname="viewport"content="width=device-width, initial-scale=1">
<title>jQuery UI Datepicker - Default functionality</title>
<link rel="stylesheet"href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<link rel="stylesheet"href="/resources/demos/style.css">
<scriptsrc="https://code.jquery.com/jquery-1.12.4.js"></script>
<scriptsrc="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script>
$( function() {
$( "#datepicker" ).datepicker();
} );
</script>
</head>
<body>
 
<p>Date: <input type="text"id="datepicker"></p>
 
 
</body>
</html>

We have run through the article date of birth in php form. If you have any feedback about the article, or you want to know more about form builder and how to save a form to the database, please read the next article, or contact us for support.

Enjoy this blog? Please spread the word :)