registration form in php
PHP Registration form
Registration Form
(USE TO HTML LANGUAGE)
Example ::-
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="
width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body class="">
<form action="index.php" method="post">
<h1>Register Here</h1>
<label>Name</label>
<input type="text" name="unm" required><br>
<label>Mobile No</label> <input
type="text" name="umob" required><br>
<label>Email Address</label>
<input type="email" name="uem" required><br>
<label>Password</label>
<input type="password" name="upwd"required><br>
<select class="form-control mt-2"
name="uque" required>
<option disabled selected>
--select sequrity Quetion--</option><br>
<option class=
"What is your hobby?">What Is Your Hobby ?
</option>
<option class="What is your
favourite color?">What is your
Favourite color?</option>
<option class="What is your School
name?">What is your School name?</option>
</select><br>
<label>Answer</label>
<input type="text" name="uans"
class="form-control " required> <br>
<input type="submit" value="Register"
name="b1">
<a href="login.php" >
Already Have an Account?</a>
</form>
</div>
</body>
</html>
Registration Form
Output
Registration Form
Example ::-
(Use to Bootstrap language )
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet"
href="css/bootstrap.css">
</head>
<body class="">
<div class="col-md-4 bg-white shadow-lg
mx-auto mt-4 p-3">
<form action="index.php" method="post">
<h1 class="text-primary">Register
Here</h1>
<label>Name</label>
<input type="text" name="unm"
class="form-control" required>
<label>Mobile No</label>
<input type="text" name="umob"
class="form-control" required>
<label>Email Address</label>
<input type="email" name="uem"
class="form-control" required>
<label>Password</label>
<input type="password" name="upwd"
class="form-control" required>
<select class="form-control mt-2"
name="uque" required>
<option disabled selected>
--select sequrity Quetion--</option>
<option class="
What is your hobby?">What Is Your Hobby ?
</option>
<option class="What is your
favourite color?">What is your Favourite color?
</option>
<option class="What is your School
name?">What is your School name?</option>
</select>
<label>Answer</label>
<input type="text" name="uans"
class="form-control " required>
<div class="text-center mt-2">
<input type="submit" value="Register"
class="btn btn-primary" name="b1">
<a href="login.php" class="btn
btn-danger">
Already Have an Account?</a>
</div>
</form>
</div>
</body>
</html>
Registration Form
Output::-
Registration Form
(Use PHP language)
Example :-
<?php
include 'connection.php';
if(isset($_POST['b1']))
{
$name = $_POST['unm'];
$mob = $_POST['umob'];
$email = $_POST['uem'];
$pass = $_POST['upwd'];
$que = $_POST['uque'];
$ans= $_POST['uans'];
$qS="SELECT * FROM userdetails
WHERE uem = '$email'";
// echo $qS;
$rs = mysqli_query($cn,$qS);
$count = mysqli_num_rows($rs);
//echo $count;
if($count == 1)
{
echo "<script>
alert('Username Already Exist');
</script>";
}
else
{
$qI="INSERT INTO userdetails
(unm,uem,upwd,umob,uque,uans)
VALUES('$name','$email','$pass'
,$mob,'$que','$ans')";
// echo $qI;
if(mysqli_query($cn,$qI))
{
echo "<script>
alert('Register Successfully');
window.location.href='login.php';
</script>";
}
else
{
echo "<script>
alert('Failed To register');
</script>";
}
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content=
"width=device-width, initial-scale=1.0">
<title>User Registration</title>
<link rel="stylesheet" href="
css/bootstrap.css">
</head>
<body class="">
<h1 class=" text-center mt-3">
<?php
$qC ="SELECT count(uid) as x
FROM userdetails";
$rsC=mysqli_query($cn,$qC);
$dataC= mysqli_fetch_assoc($rsC);
?>
Total Register User - <?php
echo $dataC['x']?>
</h1>
<div class="col-md-4 bg-white
shadow-lg mx-auto mt-5
p-3">
<h1 class="text-center text-primary">
Register Here
</h1>
<form action="index.php" method="post">
<label>Name</label>
<input type="text" name="unm"
class="form-control mb-1"
required>
<label>Mobile No</label>
<input type="text" name="umob"
class="form-control mb-1"
required>
<label>Email Address</label>
<input type="email" name="uem"
class="form-control mb-1"
required>
<label>Password</label>
<input type="password" name="upwd"
class="form-control mb-1"
required>
<select class="form-control mb-1"
name="uque" required>
<option disabled selected>
--Select Sequrity
Quetion --
</option>
<option value="What is your Hobby">
What is your Hobby?</option>
<option value="What is your Favourite
color">What is your
Favourite color?</option>
<option value="What is your
School Name">What is your School Name?
</option>
</select>
<label>Answer</label>
<input type="text" name="uans"
class="form-control mb-1"
required>
<div class="text-center">
<input type="submit"
value="Register"
name="b1" class="btn btn-primary">
<a href="login.php" class="
btn btn-danger">Already Have an Account ?
</a>
</div>
</form>
</div>
</body>
</html>
Registration Form
Output ::-
(output store in the database)
1] you can create the database
2] php code to call the database name
for example ::- wallet is database name.
<?php
$cn = mysqli_connect("localhost","root","",
"wallet");
?>
Post a Comment