-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathviewapp.php
More file actions
55 lines (40 loc) · 2.46 KB
/
viewapp.php
File metadata and controls
55 lines (40 loc) · 2.46 KB
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
<?php
include "db_conn.php";
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$email = $_POST['email'];
// Checking Cooperating Teacher
$check = "SELECT * FROM overall_appointments WHERE Email = '$email'";
$checkres = mysqli_query($conn, $check);
$appointment = mysqli_fetch_assoc($checkres);
if($email == null){
echo '<p class="error" style="margin-top: 3px;">Please type your email first in the textbox</p>';
echo '<div class="choice-container">
<button class="choice-button" type="button" onclick="hideViewpop()">Back</button>
</div>';
}
else if ($appointment) {
// Echo the input fields with the fetched data
echo '<div style="width: 100%;"><label for="name">Name:</label>';
echo '<input type="text" id="name" name="Name" placeholder="Name" value="' . htmlspecialchars($appointment['Name']) . '" readonly required></div>';
echo '<div style="width: 100%;"><label for="date">Date:</label>';
echo '<input type="text" id="date" name="Date" placeholder="Date" value="' . htmlspecialchars($appointment['Date']) . '" readonly required></div>';
echo '<div style="width: 100%;"><label for="time">Time:</label>';
echo '<input type="text" id="time" name="Time" placeholder="Time" value="' . htmlspecialchars($appointment['Time']) . '" readonly required></div>';
echo '<div style="width: 100%;"><label for="branch">Branch:</label>';
echo '<input type="text" id="branch" name="Branch" placeholder="Branch" value="' . htmlspecialchars($appointment['Branch']) . '" readonly required></div>';
echo '<div style="width: 100%;"><label for="office">Office:</label>';
echo '<input type="text" id="office" name="office" placeholder="Office" value="' . htmlspecialchars($appointment['Office']) . '" readonly required></div>';
echo '<div class="choice-container">
<button class="choice-button" type="button" onclick="printAppPDF()">Download PDF</button>
<button class="choice-button" type="button" onclick="hideViewpop()">Back</button>
</div>';
} else {
echo '<p class="error" style="margin-top: 3px;">No appointment found for the provided email</p>';
echo '<div class="choice-container">
<button class="choice-button" type="button" onclick="hideViewpop()">Back</button>
</div>';
}
}else{
header("Location: index.php?error=Please insert your Email First");
exit();
}