-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinsert.php
More file actions
executable file
·292 lines (281 loc) · 12.8 KB
/
Copy pathinsert.php
File metadata and controls
executable file
·292 lines (281 loc) · 12.8 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
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
<!DOCTYPE html>
<html lang="en">
<head>
<?php
session_start();
if(!isset($_SESSION['in']))
{
echo "<meta http-equiv='refresh' content='0; url=./login.html'/>";
}
?>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/navbar.css" rel="stylesheet">
<link href="css/forms.css" rel="stylesheet">
<link href="css/display.css" rel="stylesheet">
<link href="css/dropDown.css" rel="stylesheet">
<link href="TestCss/business-casual.css" rel="stylesheet">
<link href="css/tables.css" rel="stylesheet">
<script src="js/jquery-1.10.2.js"></script>
<script type="text/javascript" src="js/updateToggle.js"></script>
<script type="text/javascript" src="js/diagnosis.js"></script>
<script src="js/insert.js"></script>
<title>BDL-Insert</title>
</head>
<body style="background-image:url(background.jpg)">
<nav class="navbar navbar-default" role="navigation" style="box-shadow: 5px 5px 5px gray; ">
<div class="container-fluid">
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li><a class="navbar-brand"href="index.php">Home</a></li>
<li class="navbar-brand" style="color:white;">Insert Type:
<form id="form">
<select name="toggle" style=" margin:0 auto; color:black; font-size:large;">
<option>Sample</option>
<option>Submission</option>
<option>Person</option>
<option>Diagnosis</option>
<!-- <option>Diagnosis Type</option> -->
</select>
</form>
<li><a class="navbar-brand" href="search.php">Search</a></li>
<li><a class="navbar-brand" href="update.php">Update</a></li>
<li><a class="navbar-brand" href="delete.php">Delete</a></li>
<li><a class='navbar-brand' href='php/logout.php'>Logout</a></li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</br>
</nav>
<!-- Display most recent entry upon submission -->
<?php
if(isset($_SESSION['insert']))
{
$table = '<table style="margin:0 auto;" class="CSSTableGenerator" style="margin-left:15px;" border="1px"> ';
$quer = "SELECT * FROM ";
if($_SESSION['insert']=="person")
{
$quer .= "person WHERE personalid = (SELECT MAX(personalid) FROM person)";
$table .= '<tr><td>First Name</td><td>Middle Name</td><td>Last Name</td>'.
'<td>Suffix</td><td>Company</td><td>Address</td><td>City</td><td>State</td>'.
'<td>Postal Code</td><td>Country</td><td>Work Phone</td><td>Cell Phone</td>'.
'<td>Email</td><td>ID</td></tr>';
}
else if($_SESSION['insert']=="sample")
{
$quer .= "sample WHERE sampleid = (SELECT MAX(sampleid) FROM sample)";
$table .= "<tr><td>Sample ID</td><td>Type</td><td>Submission ID</td><td>Comment</td>";
}
else if($_SESSION['insert']=="submission")
{
$quer .= "submission WHERE submissionid = (SELECT MAX(submissionid) FROM submission)";
$table .= '<tr><td>Submission ID</td> <td>Submission Date</td>'.
'<td>Notification Date</td> <td>Submitter ID</td> <td>Owner ID</td></tr>';
}
include("./bees.php");
mysql_select_db("3430-s14-t6", $mydb);
$result = @mysql_query($quer, $mydb);
if($result !== false)
{
$row = mysql_fetch_array($result);
$table .= '<tr> ';
$i = 0;
for($i=0; $i < (count($row)/2); $i++)
{
if(!is_null($row[$i]))
$table .= '<td>'.$row[$i].'</td> ';
}
$table .= '</tr> </table>';
unset($_SESSION['insert']);
echo $table;
}
else
echo $quer;
}
?>
<!-- Begin Sample Entry Form -->
</br>
</br>
<form name="sampForm" id="sampForm" action="php/insertSample.php" method="post" class="form-container">
<legend style="color:white;">Sample Information:</legend>
<?php
if(isset($_SESSION['error']))
{
echo "<h4>An error has occured with the input information.</h4>";
unset($_SESSION['error']);
}
?>
<fieldset>
<label>Sample Type:</label>
<select class="form-field" id="choice" name="sampletype">
<option>Smear</option>
<option>Comb</option>
<option>Immature Bee</option>
<option>Adult Bee</option>
<option>Beetle</option>
<option>Frass</option>
<option>Other</option>
</select>
<label>Submission ID:</label>
<input class="form-field" type="text" name="submissionid" maxlength="11"size="25" required placeholder="Submission ID (Required)" />
<label>Comment: </label>
<textarea class="form-field" name="comment" cols="75" rows="10" maxlength="5000" placeholder="Enter Comment Here..."></textarea>
</fieldset>
<fieldset>
<input class="submit-button" type="submit"/>
</fieldset>
</form>
<!-- End Entry Form -->
<!-- Begin Submission Entry Form -->
<form hidden class="form-container" name="subForm" id="subForm" action="php/insertSubmission.php" method="post">
<fieldset>
<legend style="color:white;">Submission Information:</legend>
<?php
if(isset($_SESSION['error']))
{
echo "<h4>An error has occured with the input information.</h4>";
unset($_SESSION['error']);
}
?>
<label>Submission Date: </label>
<input class="form-field" type="text" name="submissiondate" maxlength="10" placeholder="YYYY/MM/DD" />
<label>Notification Date: </label>
<input class="form-field" type="text" name="notification" maxlength="10" placeholder="YYYY/MM/DD" />
<label>Submitter ID: </label>
<input class="form-field" type="text" name="submitterid" maxlength="11" required placeholder="Submitter ID (Required)" />
<label>Owner ID: </label>
<input class="form-field" type="text" name="ownerid" maxlength="11" required placeholder="Owner ID (Required)"/>
<input class="submit-button" type="submit" />
</fieldset>
</form>
<!-- End Entry Form -->
<!-- Begin Person Entry Form -->
<form hidden class="form-container" name="personForm" id="personForm" action="php/insertPerson.php" method="post">
<fieldset>
<legend style="color:white;">Owner/Submitter Information:</legend>
<legend style="font-size:large; color:white;">Name / Company:</legend>
<?php
if(isset($_SESSION['error']))
{
echo "<h4>An error has occured with the input information.</h4>";
unset($_SESSION['error']);
}
?>
<label>First Name: </label>
<input class="form-field" type="text" name="fname" maxlength="20" required placeholder="First (Required)" />
<label>Middle Name: </label>
<input class="form-field" type="text" name="mname" maxlength="20" placeholder="Middle" />
<label>Last Name: </label>
<input class="form-field" type="text" name="lname" maxlength="20" required placeholder="Last (Required)" />
<label>Suffix: </label>
<input class="form-field" type="text" name="suffix" maxlength="4" placeholder="Suffix"/>
<label>Company: </label>
<input class="form-field" type="text" name="company" maxlength="30" placeholder="Company"/></br>
</br>
<legend style="font-size:large; color:white;">Address:</legend>
<label>Street: </label>
<input class="form-field" type="text" name="address" maxlength="50" placeholder="Street"/>
<label>City:    </label>
<input class="form-field" type="text" name="city" maxlength="20" placeholder="City"/>
<label>State: </label>
<input class="form-field" type="text" name="state" maxlength="2" placeholder="State"/>
<label>Country: </label>
<input class="form-field" type="text" name="country" maxlength="50" placeholder="Country"/>
<label>Postal Code: </label>
<input class="form-field" type="text" name="postalcode" maxlength="5" placeholder="Postal Code"/></br>
</br>
<legend style="font-size:large;">Contact Information:</legend>
<label>Work Phone: </label>
<input class="form-field" type="text" name="workphone" maxlength="10" placeholder="Work Phone"/>
<label>Cell Phone: </label>
<input class="form-field" type="text" name="cellphone" maxlength="10" placeholder="Cell Phone"/>
<label>Email: </label>
<input class="form-field" type="text" name="email" maxlength="40" placeholder="Email"/>
<input class="submit-button" type="submit" />
</fieldset>
</form>
<!-- End Entry Form -->
<!-- Begin Diagnosis Entry Form -->
<form hidden class="form-container" id="diagForm" name="diagForm" action="php/insertDiagnosis.php" method="post">
<fieldset>
<legend style="color:white;">Diagnosis Information:</legend>
<?php
if(isset($_SESSION['error']))
{
echo "<h4>An error has occured with the input information.</h4>";
unset($_SESSION['error']);
}
?>
<label>Diagnosis Type: </label>
<select class="form-field" id='diagnosiskey' name="diagnosiskey" required>
<option>NDF</option>
<option>AFB</option>
<option>EFB</option>
<option>VD-B</option>
<option>CB</option>
<option>SB</option>
<option>VD-A</option>
<option>HBTM</option>
<option>NOS</option>
<option>SHB</option>
<option>GWM</option>
<option>Other</option>
</select>
<label>Sample ID: </label>
<input class="form-field" id="sampid" type="text" name="sampleid" maxlength="11" required placeholder="Sample ID(Required)" />
<label>Diagnosis Date: </label>
<input class="form-field" id="diagnosisdate" type="text" name="diagnosisdate" maxlength="10" required placeholder="YYYY/MM/DD" />
<label>Diagnosis By: </label>
<input class="form-field" id="diagnosisby" type="text" name="diagnosisby" maxlength="50" required placeholder="Name of Diagnoser" />
<label>Diagnosis Description: </label>
<textarea class="form-field" name="description" cols="75" rows="3" maxlength="150" placeholder="Enter Diagnosis Description Here..."></textarea>
<label style="padding-right:60%;">Extra Information: </label></br>
<input class="form-field" id="terra" hidden style="padding-left:2%;" type="text" maxlength="11" name="terramycinreszone" placeholder="Terramycin Resistance Zone"/>
<input class="form-field" id="tylan" hidden style="padding-left:2%;" type="text" maxlength="11" name="tylanreszone" placeholder="Tylan Resistance Zone"/>
<input class="form-field" id="mite" hidden style="padding-left:2%;" type="text" maxlength="11" name="mitecount" placeholder="Mite Count"/>
<input class="form-field" id="spore" hidden style="padding-left:2%;" type="text" name="sporecount" placeholder="Spore Count"/></br>
<label>Comment: </label>
<textarea class="form-field" name="comment" cols="75" rows="10" maxlength="5000" placeholder="Enter Comment Here..."></textarea>
</br>
<input class="submit-button" type="submit" />
</fieldset>
</form>
<!-- End Entry Form -->
<!-- Begin Diagnosis Type Entry Form
<form hidden class="form-container" id="dTypeForm" name="dTypeForm" action="php/insertDiagnosisType.php" method="post">
<fieldset>
<legend style="color:white;">Diagnosis Type Information:</legend>
<?php
/* if(isset($_SESSION['error']))
{
echo "<h4>An error has occured with the input information.</h4>";
unset($_SESSION['error']);
}
*/
?>
<label>Diagnosis Classification: </label>
<select class="form-field" id='class' name="class" required>
<option>Bacteria</option>
<option>Fungal</option>
<option>Mite</option>
<option>Other</option>
</select>
<label>Diagnosis ID: </label>
<input class="form-field" id="diagnosiskey1" type="text" name="diagnosiskey1" maxlength="5" required placeholder="Diagnosis Key" />
<label>Description: </label>
<textarea class="form-field"name="description" cols="75" rows="10" maxlength="150" placeholder="Enter Description Here..."></textarea>
<input class="submit-button" type="submit" />
</fieldset>
</form>
-->
<!-- End Entry Form -->
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
</body>
</html>