-
Notifications
You must be signed in to change notification settings - Fork 0
/
registration.php
123 lines (111 loc) · 4.84 KB
/
registration.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<?php
$hostname = "localhost";
$username = "root";
$password = "";
$db = "traveller";
$con= new mysqli($hostname,$username,$password,$db);
// for Check connection
if ($con->connect_error)
die("Database Connection failed: " . $con->connect_error);
if(isset($_POST["submit"]))
{
$fname = $_POST["fname"];
$username = $_POST['username'];
$email = $_POST['email'];
$pno = $_POST['phoneno'];
$pwd = $_POST['password'];
$gender = $_POST['gender'];
$cpwd = $_POST['cpassword'];
$sql= "INSERT INTO registration
VALUES
('$fname', '$username', '$email', '$pno', '$pwd', '$gender' )";
if (strlen($fname)<5) {
echo "<script>alert('Enter Full Name ')</script>";
}
else if (!preg_match ("/^[0-9]*$/", $pno) ){
echo "<script>alert(' Only numeric value is allowed ')</script>";
}
else if ($pwd!=$pwd){
echo "<script>alert(' Password should be similar to confirm password! ')</script>";
}
else if($con->query($sql))
{
echo "<script>alert('Record inserted ')</script>";
}
else
{
echo "<script>alert('Record insert failed ')</script>";
echo "";
}
$con->close();
}
?>
<!DOCTYPE html>
<html>
<head>
<title></title>
<link rel="stylesheet" href="register.css">
<script src="register.js" defer></script>
</head>
<body>
<div class="container">
<div class="title">Registeration</div>
<form action="#" name="registerform" method="POST">
<div class="user-details">
<div class="input-box">
<span class="details">Full Name</span>
<input type="text" name="fname" placeholder="Enter your name" required minlength="3" maxlength="50">
</div>
<div class="input-box">
<span class="details">Username</span>
<input type="text" name="username" placeholder="Enter your username" required minlength="3" maxlength="30">
</div>
<div class="input-box">
<span class="details">Email</span>
<input type="text" name="email" placeholder="Enter your email" required>
</div>
<div class="input-box">
<span class="details">Phone Number</span>
<input type="text" name="phoneno" placeholder="Enter your number" required>
</div>
<div class="input-box">
<span class="details">Password</span>
<input type="password" name="password" placeholder="Enter your password" required>
</div>
<div class="input-box">
<span class="details">Confirm Password</span>
<input type="password" name="cpassword" placeholder="Confirm your password" required>
</div>
</div>
<div class="gender-details">
<input type="radio" name="gender" id="dot-1" value="male">
<input type="radio" name="gender" id="dot-2" value="female">
<input type="radio" name="gender" id="dot-3" value="unknown">
<span class="gender-title">Gender</span>
<div class="category">
<label for="dot-1">
<span class="dot one"></span>
<span class="gender">Male</span>
</label>
<label for="dot-2">
<span class="dot two"></span>
<span class="gender">Female</span>
</label>
<label for="dot-3">
<span class="dot three"></span>
<span class="gender">Prefer not to say</span>
</label>
</div>
</div>
<div class="tbl">
<div class="button">
<input id="button1" type="submit" name="submit" value="submit" onclick="valid();">
<input id="button2" type="reset" value="Cancel">
</div>
</div>
</form>
<a class="link" href="login.php">Login</a>
</div>
</div>
</body>
</html>