-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreg.php
111 lines (110 loc) · 3.51 KB
/
reg.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
<html>
<head>
<meta charset="utf-8">
<title>eLearning - Free Educational Responsive Web Template </title>
<link rel="favicon" href="assets/images/favicon.png">
<link rel="stylesheet" media="screen" href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,700">
<link rel="stylesheet" href="assets/css/bootstrap.min.css">
<link rel="stylesheet" href="assets/css/font-awesome.min.css">
<!-- Custom styles for our template -->
<link rel="stylesheet" href="assets/css/bootstrap-theme.css" media="screen">
<link rel="stylesheet" type="text/css" href="assets/css/da-slider.css" />
<link rel="stylesheet" href="assets/css/style.css">
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="assets/js/html5shiv.js"></script>
<script src="assets/js/respond.min.js"></script>
<![endif]-->
<style>
th, td {
padding:5px;
}
</style>
</head>
<body>
<?php
include "nav.php";
$strconn=mysqli_connect("localhost","root","","project");
if(!$strconn)
echo "Connection failed".mysqli_connect_error();
else
{}
?>
<header id="head" class="secondary">
<div class="container">
<div class="row">
<div class="col-sm-8">
<h1>Registration</h1>
</div>
</div>
</div>
</header>
<form method="POST" action="" id="regform">
<table border=0 align="center">
<tr>
<td><label>Enter Your First Name :</label></td>
<td><input type="text" class="form-control" name="fname" placeholder="First Name"></td>
</tr>
<tr>
<td><label>Enter Your Last Name :</label></td>
<td><input type="text" class="form-control" name="lname" placeholder="Last Name"></td>
</tr>
<div class="checkbox">
<tr>
<td><label>Gender :</label></td>
<td><input type="radio" name="gender" value="male">Male <input type="radio" name="gender" value="female">Female</td>
</tr>
</div>
<tr>
<td><label>Email address :</label></td>
<td><input type="email" class="form-control" name="email" placeholder="Email ID"></td>
</tr>
<tr>
<td><label>Enter Your User Name :</label></td>
<td><input type="text" class="form-control" name="username" placeholder="User Name"></td>
</tr>
<tr>
<td><label>Enter Your Password :</label></td>
<td><input type="password" class="form-control" name="pass" placeholder="Password"></td>
</tr>
<tr>
<td><label>Confirm Password :</label></td>
<td><input type="password" class="form-control" name="pass1" placeholder="Confirm Password"></td>
</tr>
<tr>
<td colspan="2" align="center"><button class="btn btn-block" name="btn">Register</button></td>
</tr>
<tr>
<td colspan="2" align="center"><button class="btn btn-block">Reset</button></td>
</tr>
</table>
</form>
<?php
if(!empty($_POST['fname'])&&!empty($_POST['lname']))
{
if(isset($_POST['btn']))
{
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$gender = $_POST['gender'];
$email = $_POST['email'];
$username = $_POST['username'];
$password = $_POST['pass'];
$query = "INSERT INTO user_info(FirstName,LastName,Gender,Email_id,UserName,Password) VALUES('$fname','$lname','$gender','$email','$username','$password')";
$result = mysqli_query($strconn,$query);
if($result)
{
echo "<div class='alert alert-success' role='alert'>Sign up successful</div>";
}
else
{
echo "<div class='alert alert-danger' role='alert'>Username or Email already registered</div>";
}
}
}
?>
<?php
include "footer.php";
?>
</body>
</html>