-
Notifications
You must be signed in to change notification settings - Fork 2
/
booktest_process_pack.php
86 lines (68 loc) · 2.87 KB
/
booktest_process_pack.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
<?php include 'connection.php' ?>
<?php
$aadhar=$_POST['aadhar'];
$name=$_POST['name'];
$city=$_POST['city'];
$street=$_POST['street'];
$pin=$_POST['pin'];
$dob=$_POST['dob'];
$phone=$_POST['phone'];
$aphone=$_POST['aphone'];
$pack=$_POST['pack'];
$did=rand(1,6);
if($name!="" && $city!="" && $street!="" && $pin!="" && $aadhar!="" && $dob!="" && $phone!=""){
$time=strtotime($dob);
$dob=date('Y-m-d',$time);
echo $pack;
$query="INSERT INTO patient(Aadhar_id,Name,Phone,AlterPhone,DOB,Street,City,pincode,D_id) VALUES('$aadhar','$name','$phone','$aphone','$dob','$street','$city','$pin','$did')";
mysqli_query($con,$query);
if($pack=="basic"){
echo "1";
$test=["Haemoglobin","RBC test","WBC test","Urine test","Sugar"];
for($i=0;$i<count($test);$i++){
$query="SELECT * FROM sorts_test WHERE Test_Name='$test[$i]'";
$res=mysqli_query($con,$query);
$a=mysqli_fetch_assoc($res);
$user=$a["User_id"];
$query="INSERT INTO doc_report(Aadhar_id,date,D_id,User_Id,Test_Name) VALUES($aadhar,NOW(),$did,'$user','$test[$i]')";
mysqli_query($con,$query);
}
header("Location: index.php");
exit();
}
else if($pack=="medium"){
$test=["LFT","HDL","LDL","Thyroid"];
for($i=0;$i<count($test);$i++){
if($test[$i]!="None"){
$query="SELECT * FROM sorts_test WHERE Test_Name='$test[$i]'";
$res=mysqli_query($con,$query);
$a=mysqli_fetch_assoc($res);
$user=$a["User_id"];
$query="INSERT INTO doc_report(Aadhar_id,date,D_id,User_Id,Test_Name) VALUES($aadhar,NOW(),$did,'$user','$test[$i]')";
mysqli_query($con,$query);
}
}
header("Location: index.php");
exit();
}
else{
$test=["Marrow Test","Neuron test"];
for($i=0;$i<count($test);$i++){
if($test[$i]!="None"){
$query="SELECT * FROM sorts_test WHERE Test_Name='$test[$i]'";
$res=mysqli_query($con,$query);
$a=mysqli_fetch_assoc($res);
$user=$a["User_id"];
$query="INSERT INTO doc_report(Aadhar_id,date,D_id,User_Id,Test_Name) VALUES($aadhar,NOW(),$did,'$user','$test[$i]')";
mysqli_query($con,$query);
}
}
header("Location: index.php");
exit();
}
}
else{
header("Location: booktest-pack.php");
exit();
}
?>