-
Notifications
You must be signed in to change notification settings - Fork 0
/
Register.php
91 lines (80 loc) · 2.29 KB
/
Register.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Register</title>
<link rel="stylesheet" href="style_register.css">
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-4 offset-md-4">
<div class="header">
<h2>Register</h2>
</div>
<form method="post" action="Register.php">
<div class="input-group">
<label>Full Name:</label>
<input type="text" name="fname" required>
</div>
<div class="input-group">
<label>Phone Number:</label>
<input type="text" name="phone" required>
</div>
<div class="input-group">
<label>Email Address:</label>
<input type="email" name="email" required >
</div>
<div class="input-group">
<label>National ID:</label>
<input type="text" name="id_no" required>
</div>
<div class="input-group">
<label for="gender">Choose Gender</label>
<select id="gender">
<option value="male">Male</option>
<option value="female">Female</option>
<option value="other">Other</option>
</select>
</div>
<div class="input-group">
<label>Location</label>
<input type="text" name="location">
</div>
<div class="input-group">
<button type="submit" class="btn" name="register_btn">Register</button>
</div>
<p>
Already a member? <a href="sign_in.php">Sign in</a>
</p>
<?php
if(isset($_POST['register_btn'])){
include 'includes/config.php';
$fname = $_POST['fname'];
$id_no = $_POST['id_no'];
$gender = $_POST['gender'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$location = $_POST['location'];
$qry = "INSERT INTO client (fname,id_no,gender,email,phone,location,status)
VALUES('$fname','$id_no','$gender','$email','$phone','$location','Available')";
$result = $conn->query($qry);
if($result == TRUE){
echo "<script type = \"text/javascript\">
alert(\"Successfully Registered.\");
window.location = (\"sign_in.php\")
</script>";
} else{
echo "<script type = \"text/javascript\">
alert(\"Registration Failed. Try Again\");
window.location = (\"#\")
</script>";
}
}
?>
</form>
</div>
</div>
</div>
</body>
</html>