-
Notifications
You must be signed in to change notification settings - Fork 0
/
DeletePost.html
54 lines (47 loc) · 1.58 KB
/
DeletePost.html
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
<?php
echo "<link href='php/css/delete_table.css' rel='stylesheet' type='text/css'>";
$mysqli = new mysqli("mysql.eecs.ku.edu", "clee28", "2482962", "clee28");
if ($mysqli->connect_errno) {
printf("Connect failed: %s\n", $mysqli->connect_error);
exit();
}
$show_post = "SELECT author_id,content,post_id FROM Posts ORDER BY post_id ASC";
function displayPost(){
$result = $GLOBALS['mysqli']->query($GLOBALS['show_post']);
if(($result->num_rows) > 0)
{
echo "<div class='post_div'> <table><tr> <td>Author</td><td>Content</td><td>Delete?</td> </tr>";
while($row = $result->fetch_assoc())
{
echo "<tr><td>" . $row['author_id'] . "</td>";
echo "<td>" . $row['content'] . "</td>";
echo "<td><input type='checkbox' name='delete[]' value='" . $row['post_id'] . "'></td></tr>";
}
echo "</table></div>";
}
else
{
echo "No post exists.";
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Lab5 - Delete Post</title>
</head>
<body style="font-family: Arial">
<h1>Delete Post</h1>
<hr />
<form action="php/DeletePost.php" method="post">
<div>
<?php displayPost(); ?>
</div>
<br>
<div>
<button type="submit" style="margin:20px auto;font-weight:bold;border-radius:10px">Delete</button>
<a href="AdminHome.html"><button type="button" style="margin:20px auto;font-weight:bold;border-radius:10px">Go Back</button></a>
</div>
</form>
</body>
</html>