-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathprotocolList.php
114 lines (79 loc) · 3.87 KB
/
protocolList.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
<head>
<link rel="stylesheet" type="text/css" href="style/protocol.css">
</head>
<body>
<?php
include 'header.php';
?>
<?php
$value="Choose a protocol";
if($_REQUEST)
{
$value=$_REQUEST["From_prot"];
}
?>
<div style="margin:25px">
<div class="color">
<br><h6 style="color:#343A40">Please enter the name of the protocol you want to query in the search box below.</h6></br>
<form action="" method='post' id="myPname">
<link rel="stylesheet" href="bootstrap-select.min.css">
<script src="bootstrap-select.min.js"></script>
<select class="selectpicker" data-live-search="true" name="From_prot" onchange="submitform()">
<?php
include 'db.php';
$result = mysqli_query($conn,"SELECT * FROM Protocols");
while($row = $result->fetch_assoc()) {
$ProtocolName = $row['ProtName']; ?>
<option value="<?php echo $ProtocolName; ?>"<?php echo $value=="$ProtocolName"?"selected='$ProtocolName'":""?>><?php echo $ProtocolName; ?></option>
<?php
}
include 'closeDB.php';
?>
</select>
</form>
<form action='showProtocol.php' method = 'post'>
<?php
include 'db.php';
if (isset($_POST['From_prot'])){
$protName = $_POST['From_prot'];
$result = mysqli_query($conn,"SELECT * FROM Protocols where ProtName = '$protName'");
while($row = $result->fetch_assoc()) {
$ProtID = $row['ProtID'];
$ProtName = $row['ProtName'];
$procedure = $row['ProtMethod'];
$equipment = $row['EquipmentID'];
$protCreater = $row['Creater'];
}
echo '<input type="hidden" name="protName" value="' . $ProtName . '">';
echo '<input type="hidden" name="procedure" value="' . $procedure . '">';
echo '<input type="hidden" name="equipment" value="' . $equipment . '">';
echo '<input type="hidden" name="ProtCreater" value="' . $protCreater . '">';
$result = mysqli_query($conn,"SELECT * FROM ProtocolGuide where ProtID = '$ProtID'");
while($row = $result->fetch_assoc()) {
$dosage = $row['Dosage'];
$SupID = $row['SupID'];
$result1 = mysqli_query($conn,"SELECT * FROM Supplement where SupID = '$SupID'");
while($row1 = $result1->fetch_assoc()) {
$chemical = $row1['SupName'];
echo '<input type="hidden" name="chemicals[]" value="' . $chemical . '">';
echo '<input type="hidden" name="dosages[]" value="' . $dosage . '">';
}
}
}
include 'closeDB.php';
?>
<button type="submit" class="button"><span>Show</span></button>
</form>
</div>
</div>
</body>
<!-- submit the protocol name to this page -->
<script type="text/javascript">
function submitform(){
var form = document.getElementById("myPname");
form.submit();
}
</script>
<script type="text/javascript">
document.getElementById('myPname').value = "<?php echo $_POST['From_prot'];?>";
</script>