-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpatient_regi.php
115 lines (70 loc) · 3.2 KB
/
patient_regi.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
<?php include('header.php'); ?>
<!-- this is for donor registraton -->
<div class="recipient_reg" style="background-color:#272327;">
<h3 class="text-center" style="background-color:#272327;color: #fff;">Patient Registration</h3>
<div class="formstyle" style="float: right;padding:25px;border: 1px solid lightgrey;margin-right:415px; margin-bottom:30px;background-color:#f3f3f8;color:#141313;">
<form enctype="multipart/form-data" method="post" class="text-center">
<div class="col-md-12">
<label>
Your Name: <input type="text" name="name" value="" placeholder="Full name" required>
</label><br><br>
<label>
Age: <input type="number" name="age" placeholder="age" pattern="[0-9]{2,2}" title="please enter only numbers between 2 to 2 for age"/>
</label><br><br>
<label>
Mobile: <input type="number" name="contact" placeholder="contact no" required="required" pattern="[0-9]{10,11}" title="please enter only numbers between 10 to 11 for mobile no."/>
</label><br><br>
<label>
Address: <input type="text" name="address" value="" placeholder="address">
</label><br><br>
<label>
Blood Group: <select name="bgroup" required>
<option value="">-select-</option>
<option value="O+">O+</option>
<option value="O-">O-</option>
<option value="AB+">AB+</option>
<option value="AB-">AB-</option>
<option value="A+">A+</option>
<option value="A-">A-</option>
<option value="B+">B+</option>
<option value="B-">B-</option>
</select>
</label><br><br>
<label>
Email: <input type="email" name="email" value="" placeholder="email" required>
</label><br><br>
<label>
Password: <input type="password" name="password" value="" placeholder="password" required>
</label><br><br>
<button name="submit" type="submit" style="margin-left:60px;width: 85px;border-radius: 3px;">Register</button> <br>
</div> <!-- col-md-12 -->
</form>
</div>
</div>
<?php include('footer.php'); ?>
</div><!-- containerFluid Ends -->
<script src="js/bootstrap.min.js"></script>
<!-- validation and insertion -->
<?php
include('config.php');
if(isset($_POST['submit'])){
$sql1 = "SELECT * FROM patient WHERE email='".$_POST["email"]."' ";
$result = $conn->query($sql1);
if ($result->num_rows > 0) {
echo "<script>alert('Sorry, user already exist!');</script>";
}
else{
$sql = "INSERT INTO patient (name,age,contact,address,bgroup,email, password)
VALUES ('" . $_POST["name"] ."','" . $_POST["age"] . "','" . $_POST["contact"] . "','" . $_POST["address"] . "','" . $_POST["bgroup"] . "', '" . $_POST["email"] . "','" . $_POST["password"] . "' )";
if ($conn->query($sql) === TRUE) {
echo "<script>location.replace('patient_success_msg.php');</script>";
} else {
echo "<script>alert('There was an Error')<script>" . $sql . "<br>" . $conn->error;
}
$conn->close();
}
}
?>
<!-- validation and insertion End-->
</body>
</html>