-
Notifications
You must be signed in to change notification settings - Fork 2
/
stationlist.php
132 lines (93 loc) · 3.3 KB
/
stationlist.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
<!DOCTYPE html>
<html lang="en">
<head>
<title>Corresponding entries</title>
<meta name="description" content="">
<meta name="author" content="">
</head>
<body>
<?php include_once("header.php");?>
<div class="container">
<div class="text-center">
<h1>Marine</h1>
<p class="lead">List of corresponding stations.</p>
</div>
</div>
<div class="container">
<?php
if(isset($_POST['submit'])){
$table = $_POST['table'];
//$table = 'station';
if($table = 'station'){
if(!empty($_POST['station_list'])) {
include("db.php");
$name = $_POST['station_list'];
//$showhide = $_POST['station_to_hide'];
$showhide = '';
print($showhide);
$sql = "SELECT * FROM Stations
WHERE Sname IN ('" . implode("','", $name) ."') AND Shidden = '$showhide'
;
";
if (mysqli_query($conn, $sql)) {
$result = mysqli_query($conn, $sql);
$num = mysqli_num_rows($result);
//echo "<form action=\"Hidden_elements.php \" method=\"post\">";
echo "Find the desired station ID below:";
echo "<div class=\"checkbox\" name = station_hide[]>";
echo "<table class=\"table\" id=\"datatable\">";
echo "<thead>";
echo "<tr><th>ID</th><th>Name</th><th>Sequence</th><th>Longitude</th><th>Latitude</th></tr>";
echo "</thead>";
echo "<tbody>";
while($row = mysqli_fetch_assoc($result)) {
echo "<td>" . $row["SID"]."</td>";
$stationid=$row["SID"];
echo "<td>" . $row["Sname"]."</td>";
$stationname=$row["Sname"];
echo "<td>" . $row["Ssequence"]."</td>";
$stationsequence=$row["Ssequence"];
echo "<td>" . $row["Slongitude"]."</td>";
$stationlongitude=$row["Slongitude"];
echo "<td>" . $row["Slatitude"]."</td></tr>";
$stationlatitude=$row["Slatitude"];
}
echo "</tbody>";
echo "</table>";
include 'closeDB.php'; //close database connection script
echo "</div>";
} else {
echo "Error: " . $sql . "<br>" . mysqli_error($conn);
}
}
}
else {
echo "Error: " . $sql . "<br>" . mysqli_error($conn);
}
}
else{
echo "<b>No stations selected.</b> </p>";
}
?>
</div><!-- /.container -->
<div class="container">
<div class="text-center">
<h1>Change Station data</h1>
<br>
<form action="updatestation.php" method="post">
<table class="table-condensed" align="center">
<thead><tr><th></th></tr></thead>
<tbody align="right">
<tr><td>Station ID:</td><td><input type="text" Value=<?php echo $stationid ?> name="SID"></td></tr>
<tr><td>Station Name:</td><td><input type="text" Value=<?php echo $stationname ?> name="Sname"></td></tr>
<tr><td>Station Sequence:</td><td><input type="text" Value=<?php echo $stationsequence ?> name="Ssequence"></td></tr>
<tr><td>Station Longitude:</td><td><input type="text" Value=<?php echo $stationlongitude ?> name="Slongitude"></td></tr>
<tr><td>Station Latitude:</td><td><input type="text" Value=<?php echo $stationlatitude ?> name="Slatitude"></td></tr>
</tbody>
</table>
<input type="submit" name="submit" Value="Submit"/>
</form>
</div>
</div><!-- /.container -->
</body>
</html>