-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBlog.php
129 lines (103 loc) · 3.8 KB
/
Blog.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
<?php
require_once ("Includes/simplecms-config.php");
require_once ("Includes/connectDB.php");
include("Includes/header.php");
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
?>
<script>
function NewProject() {
var x;
var site = prompt("Please enter the name of a new project", "Project name here");
if (site != null) {
}
}
</script>
<div id="main">
<form action="" method="post">
Report number:
<input type="submit" name="nav_btn" value="<">
<?php
if (!empty($_POST['nav_btn'])) {
switch($_POST['nav_btn']){//if the submit button is clicked
case 'Go':
$Rpt_Num = $_POST['Rpt_Num'];
echo "<input type='text' name='Rpt_Num' size ='5' value='$Rpt_Num' class='NavTextBox'>";
break;
case '<':
$Rpt_Num = $_POST['Rpt_Num'];
$Rpt_Num = $Rpt_Num - 1;
echo "<input type='text' name='Rpt_Num' size ='5' value='$Rpt_Num' class='NavTextBox'>";
break;
case '>':
$Rpt_Num = $_POST['Rpt_Num'];
$Rpt_Num = $Rpt_Num + 1;
echo "<input type='text' name='Rpt_Num' size ='5' value='$Rpt_Num' class='NavTextBox'>";
break;
case 'Submit Near Miss Report':
$Rpt_Num = $_POST['Rpt_Num'];
echo "<input type='text' name='Rpt_Num' size ='5' value='$Rpt_Num' class='NavTextBox'>";
break;
case 'Update Report':
$Rpt_Num = $_POST['Rpt_Num'];
echo "<input type='text' name='Rpt_Num' size ='5' value='$Rpt_Num' class='NavTextBox'>";
break;
}
}
if(empty($_POST['nav_btn'])){
$query = "SELECT Failure_Idx FROM failures ORDER BY Failure_Idx ASC";
$result = mysqli_query($conn, $query);
if (mysqli_num_rows($result) > 0) {
// output data of each row
while($row = mysqli_fetch_assoc($result)) {
$result1 = $row['NM_Index'];
}
} else {
}
$result = $result1 + 1;
echo "<input type='text' name='Rpt_Num' size ='5' value='" . $result . "' class='NavTextBox'>";
}
?><!--Navigation Bar-->
<input type="submit" name="nav_btn"value=">">
<input type="submit" name="nav_btn" value="Go">
<br><br>
<?php
if (!empty($_POST['nav_btn'])) {
switch($_POST['nav_btn']){//if the submit button is clicked
case 'Go':
break;
case '<':
break;
case '>':
break;
case 'Submit Near Miss Report':
break;
case 'Update Report':
break;
}
}
if(empty($_POST['nav_btn'])){
$sql = "SELECT Blog.Project_Name from Blog_Index Blog Where Blog.Closed = 0";
$result = mysqli_query($conn, $sql);
echo "<table>";
if (mysqli_num_rows($result) > 0) {
// output data of each row
while($row = mysqli_fetch_assoc($result)) {
$result1 = $row['Project_Name'];
echo "<tr class='alt'><td><FONT SIZE=4>" . $result1 . "</FONT></td>";
echo "<td><input type='submit'value='See comments'></td></tr>";
}
} else {
}
echo "</table>";
}
?>
</form>
</div>
<?php
include ("Includes/footer.php");
?>