Basic Registration form in PHP with MySQL database connectivity
Hello Friends, Today in this blog you will learn PHP Registration form in PHP with MySQL database connectivity.
In the earlier blog, I have shared to create a simple website layout using HTML and CSS, Now it's time to learn Registration form in PHP with MySQL database connectivity.
So Here is the code and my work. I hope you are gonna love this and share whith your friends too. So let's Start learning PHP Registration form in PHP with MySQL database connectivity.
I'm happy to post here my insight and methods utilized in PHP and MySQL. As you all mindful that PHP and MySQL are the most broadly utilized Open Source for sites. The present great many sites and applications are utilizing these free software's.
Actually I feel that this could be next level for front end engineers by utilizing PHP and MySQL a HTML designer can make a site more unique. Allow us to talk about How to make a Basic registration form in PHP with database, Its straightforward and exceptionally valuable for an essential site dynamic client dynamic enlistment.
Each innovative can execute its essential construction to their site. Presently Just follow these basic advances and you will find that your first dynamic functional PHP registration form with database connection entry on every form fill up.
STEP 1: Create Database for inserting values
CREATE TABLE `registration` (
`id` int(11) NOT NULL,
`fname` varchar(50) NOT NULL,
`lname` varchar(50) NOT NULL,
`email` text NOT NULL,
`paswd` varchar(255) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
STEP 2: Create HTML Registration Form (Front end code)
Create a new file registration.php, Here is the code
<!DOCTYPE html>
<html lang="eng">
<head>
<title>PHP MySQL Registration System</title>
<link rel="stylesheet" type="text/css" href="style.css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<div class="container">
<div class="form_content">
<div class="title">
Please sign up
</div>
<form method="post" action="registration.php">
<div class="row">
<input type="text" name="fname" placeholder="First Name" required class="input-sm">
<input type="text" name="lname" placeholder="Last Name" required class="input-sm">
</div>
<input type="email" name="email" placeholder="Email" required class="input-sm">
<input type="password" name="paswd" placeholder="Password" required class="input-sm">
<input type="submit" name="sub_btn" value="Register" id="btn">
</form>
</div>
</div>
</body>
</html>
STEP 3: For Database connectivity using MySQL
Make a connection.php file for stablished connection database use that default code as below
$conn = mysqli_connect("localhost","root","","tutorials") or die($conn);
if ($conn) {
echo "connection Succesfuly";
}else{
echo "Something Error";
}
STEP 4: Finally make a registration page with .php extension, From get value of all fields shown in HTML page
Here a Front end developer can keep in touch with some own code in PHP, Read the code and comprehend this essential design line by line you will think that its extremely simple.
<!DOCTYPE html>
<html lang="eng">
<head>
<title>PHP MySQL Registration System</title>
<link rel="stylesheet" type="text/css" href="style.css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<div class="container">
<div class="form_content">
<div class="title">
Please sign up
</div>
<form method="post" action="registration.php">
<div class="row">
<input type="text" name="fname" placeholder="First Name" required class="input-sm">
<input type="text" name="lname" placeholder="Last Name" required class="input-sm">
</div>
<input type="email" name="email" placeholder="Email" required class="input-sm">
<input type="password" name="paswd" placeholder="Password" required class="input-sm">
<input type="submit" name="sub_btn" value="Register" id="btn">
</form>
</div>
</div>
</body>
</html>
Conclusion
By following bit by bit strategy gave over a fundamental registration form can be made. So best of luck for your first
PHP code.
0 Comments