-
Notifications
You must be signed in to change notification settings - Fork 1
/
signup.php
94 lines (84 loc) · 2.97 KB
/
signup.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
<?php
include('top_header.php');
echo "<title>Sign Up</title>";
include('header.php');
include('connection.php');
?>
<h1 style="text-align:center">Sign Up</h1>
<center>
<div class="box-signup">
<form action="signup.php" method="post">
<div class="form-row">
<div class="col-md-4 mb-4">
<label for="validationServer01">First name</label>
<input type="text" class="form-control" id="validationServer01" placeholder="First name" name="fname" required>
</div>
<div class="col-md-4 mb-4">
<label for="validationServer02">Last name</label>
<input type="text" class="form-control" id="validationServer02" placeholder="Last name" name="lname" required>
</div>
<div class="col-md-4 mb-4">
<label for="validationServerUsername">Email</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text" id="inputGroupPrepend3">@</span>
</div>
<input type="text" class="form-control" id="validationServerUsername" name="email" placeholder="email" aria-describedby="inputGroupPrepend3" required>
</div>
</div>
</div>
<div class="form-row">
<div class="col-md-2 mb-4">
</div>
<div class="col-md-4 mb-4">
<label for="validationServer03">Contact no</label>
<input type="text" class="form-control" id="validationServer03" placeholder="Contact No" name="contact_no" required>
</div>
<div class="col-md-4 mb-4">
<label for="validationServer04">Password</label>
<input type="password" class="form-control" id="validationServer04" placeholder="password" name="password" required>
</div>
<div class="col-md-2 mb-4">
</div>
</div>
<div class="form-group">
<div class="form-check">
<input type="checkbox" value="" id="invalidCheck3" required>
<label class="form-check-label" for="invalidCheck3">
Agree to terms and conditions
</label>
</div>
</div>
<button class="btn btn-primary" type="submit" name="submit">Sign up</button>
<button class="btn btn-primary" type="reset" name="submit">Clear</button>
</form>
<?php
if(isset($_POST['submit']))
{
$fname=$_POST['fname'];
$lname=$_POST['lname'];
$email=$_POST['email'];
$contact_no=$_POST['contact_no'];
$password=md5($_POST['password']);
$q1="SELECT * FROM user where email='$email'";
$que=mysqli_query($conn,$q1);
if(mysqli_num_rows($que)==0)
{
$query="INSERT INTO user (first_name,last_name,email,contact_no,password,role) VALUES ('$fname','$lname','$email','$contact_no','$password','customer')";
$result=mysqli_query($conn,$query);
if(!$result)
die('data not inserted'.mysqli_error($conn));
else {
echo "Data insertd";
}
}
else {
echo "Email already inserted";
}
}
?>
</div>
</center>
<?php
include("footer.php")
?>