-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlanets.php
112 lines (98 loc) · 3.99 KB
/
Planets.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
<?php
$title = "Planets";
include 'header.php';
include "DBHelper.php";
include "db_queries.php";
?>
<div class="container">
<div class="row col-md-12 tBorder">
<table id="dynamicT" name="dynamicT" class="table table-striped display custab table-bordered" cellspacing="0" width="100%">
<thead class="tableH">
<tr>
<!--<th>ID</th>-->
<th>Planet Name</th>
<th>Climate</th>
<th>Population</th>
<th class="text-center">Notes</th>
<th class="text-center">Action</th>
</tr>
</thead>
<?php
if (db_connect()) {
//echo "Connected!";
$result = db_generic_select($swdb_planets_select_all);
$arr_len = count($result);
//echo " " . $arr_len;
for ($x = 0; $x < $arr_len; $x++) {
echo "<tr>";
//echo "<td>" . $result[$x]['pid'] . "</td>";
echo "<td nowrap=\"nowrap\">" . $result[$x]['plan_name'] . "</td>";
echo "<td nowrap=\"nowrap\">" . $result[$x]['climate'] . "</td>";
echo "<td nowrap=\"nowrap\">" . $result[$x]['population'] . "</td>";
echo "<td>" . $result[$x]['notes'] . "</td>";
echo "<td nowrap=\"nowrap\ class=\"text-center\"><a class="
. "\"btn btn-info btn-xs\" href=\"PlanEdit.php?id=". $result[$x]['pid'] ."\"><span class="
. "\"glyphicon glyphicon-edit\"></span> Edit </a>"
. " <a href=\"PlanDelete.php?id=" .$result[$x]['pid'] ."\" class=\"btn btn-danger btn-xs\">"
. "<span class=\"glyphicon glyphicon-remove\">"
. "</span> Delete </a></td>";
echo "</tr>";
}
} else {
//echo "FAILED!";
}
?>
</table>
<script>
$(document).ready(function() {
$('#dynamicT').DataTable();
});
</script>
</div>
<div class="container">
<!-- Trigger the modal with a button -->
<button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Add a Planet</button>
<!-- START ADD Modal -->
<div class="modal fade" id="myModal" role="dialog">
<div class="modal-dialog">
<!-- ADD Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Add a Planet to the UO SWDB</h4>
</div>
<div class="modal-body">
<form action="PlanInsert.php" method="post">
<div class="form-group">
<label for="plan_name">Planet Name:</label>
<input type="text" class="form-control" id="plan_name" name="plan_name">
</div>
<div class="form-group">
<label for="climate">Climate:</label>
<input type="text" class="form-control" id="climate" name="climate">
</div>
<div class="form-group">
<label for="population">Population:</label>
<input type="text" class="form-control" id="population" name="population">
</div>
<div class="form-group">
<label for="notes">Notes:</label>
<textarea type="text" rows="10" class="form-control" id="notes" name="notes"></textarea>
</div>
<button type="submit" name="submit" class="btn btn-default">Submit</button>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
</div>
</div>
</div>
</div>
</div>
<!-- End Add Modal -->
<!-- START delete modal -->
<!-- END delete modal -->
</div>
<?php
include 'footer.php';
?>