-
Notifications
You must be signed in to change notification settings - Fork 1
/
patient_reg.php
45 lines (37 loc) · 1.27 KB
/
patient_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
<?php
include("config.php");
$name = $_POST["name"];
$email = $_POST["email"];
$phone = $_POST["phone"];
$dob = $_POST["dob"];
$address = $_POST["address"];
$height = $_POST["height"];
$weight = $_POST['weight'];
$gender = $_POST["gender"];
if($_POST["password"] == $_POST["repassword"]){
$pass = $_POST["password"];
}else{
die("Passwords entered do not match");
}
if($_POST["ec_name"] != null){
$ec_name = $_POST["ec_name"];
$ec_phone = $_POST["ec_phone"];
$qContact = "INSERT INTO emergency_contact (ec_name, ec_phone) VALUES ('$ec_name','$ec_phone')";
$a = mysqli_query($conn,$qContact);
if(!$a){
die(mysqli_error($conn));
}
$ec_id = mysqli_insert_id($conn);
$qPatient = "INSERT INTO patient (p_name, p_email, p_phone, p_gender, p_dob, p_height, p_weight, p_password_hash, ec_id)
VALUES ('$name','$email','$phone','$gender','$dob','$height','$weight','$pass','$ec_id')";
}else{
$qPatient = "INSERT INTO patient (p_name, p_email, p_phone, p_gender, p_dob, p_height, p_weight, p_password_hash)
VALUES ('$name','$email','$phone','$gender','$dob','$height','$weight','$pass')";
}
$a = mysqli_query($conn,$qPatient);
if(!$a){
die(mysqli_error($conn));
}
include("patient_login.php");
mysqli_close($conn);
?>