-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathprescription-upload.php
178 lines (113 loc) · 4.04 KB
/
prescription-upload.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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
<head>
<title>Doctor Dashboard | Healing Infirmary</title>
<link rel="icon" href="assets/img/mlogo.png">
</head>
<?php
session_start();
include('include/conn.php');
include_once('sql.php');
if(strlen($_SESSION['email'])==0)
{
header('location:login.php');
}
else{
$_SESSION['email'];
$eamil=$_SESSION['email'];
$result = mysqli_query($conn,"SELECT * FROM doctor_reg Where email='$eamil'");
if (mysqli_num_rows($result) > 0) {
$i=0;
$row = mysqli_fetch_array($result);
}
else{
echo "No result found";
}
include_once('include/header.php');
include_once('include/Doctor-sidebar.php');
$mail=$_GET['id'];
?>
<!-- ============================================== -->
<?php
//connect to DB
//Flash Message
$message="";
if(isset($dbh)){
//connection check
if(isset($_POST['submit'])){
$stmt = $dbh->prepare("INSERT INTO `doucument`(`doc_type`,`date`,`email`,`image`) VALUES (:doc_type, :date, :email,:image)");
//bindParam
$stmt->bindParam(':doc_type', $doc_type);
$stmt->bindParam(':date', $date);
$stmt->bindParam(':image', $image);
$stmt->bindParam(':email', $email);
//insert File
$target_dir = "assets/img/user/";
$target_file = $target_dir . basename($_FILES["image"]["name"]);
$imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
//Fatch data user form
if (move_uploaded_file($_FILES["image"]["tmp_name"], $target_file)) {
$doc_type= $_POST['doc_type'];
$date = $_POST['date'];
$image = $target_file;
$email=$_SESSION['email'];
//This variable data has been assigned by us
//check name
//check name
//checkpassword weather passwrod is same or not....
//confiramation of first value inseration ....
if($stmt->execute()){
$message="Insert Row Success";
header("Location:view-document.php");
}
else{
$message="Insert Row Fail";
}
}
}
}
?>
<main class="app-content">
<div class="app-title">
<div>
<h1><i class="fa fa-dashboard"></i>Doctor Dashboard</h1>
<p></p>
</div>
<ul class="app-breadcrumb breadcrumb">
<li class="breadcrumb-item"><i class="fa fa-home fa-lg"></i></li>
<li class="breadcrumb-item"><a href="#">Dashboard</a></li>
</ul>
</div>
<div class="row">
<div class="col-md-6 m-auto">
<div class="tile">
<h3 class="tile-title">Input Presciption </h3>
<div class="tile-body">
<form action="prescription-upload.php" method="post" class="form-horizontal" enctype="multipart/form-data">
<div class="message text-danger"><?php if($message!="") { echo $message; } ?></div>
<div class="form-group">
<label class="control-label">Suggestions Here:<span class="text-danger">*</span></label>
<input type="text" name="doc_type" id="" class="form-control" placeholder=" Write your suggestion" autocomplete="off">
<div class="form-group">
<label class="control-label">Current Date:<span class="text-danger">*</span></label>
<input type="date" name="date" id="confirmpassword" class="form-control" placeholder="RE-type Password" autocomplete="off">
<span id='message'></span>
</div>
<label class="control-label">User Email:<span class="text-danger">*</span></label>
<input type="email" name="dmail" id="" class="form-control" placeholder=" User Email" autocomplete="off" value="<?php echo $mail;?>">
</div>
<div class="form-group">
<label class="control-label">Prescription <span class="text-danger">*</span></label>
<input type="file" name="image" id="" class="form-control">
</div>
<div class="form-group btn-container">
<button class="btn btn-primary btn-block" type="submit" name="submit" value="submit"><i class="fa fa-sign-in fa-lg fa-fw"></i>Upload</button>
</div>
</form>
</div>
</div>
</div>
</main>
<?php
include_once('include/footer.php');
include_once('include/Hfooter.php');
}
?>