-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpost_view.php
More file actions
48 lines (42 loc) · 1.18 KB
/
post_view.php
File metadata and controls
48 lines (42 loc) · 1.18 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
<?php
session_start();
require "core/config.php";
if (!isset($_GET["id"])) {
header("location: index.php");
exit();
}
$post_query = $connection->query("SELECT * FROM post WHERE ID = '{$_GET['id']}'");
$post = mysqli_fetch_array($post_query);
if (!$post) {
header("location: index.php");
exit();
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?php echo $post['title']; ?></title>
<link rel="stylesheet" href="css/bootstrap.css">
<link rel="stylesheet" href="css/style.css">
<style>
body {
background-color:rgb(213, 217, 220);
}
</style>
</head>
<body>
<div class="content">
<header>
<h2>PHP CRUD APPLICATION</h2>
<a href="index.php" class="btn btn-light w-100"><i>Back To Main Page</i></a>
</header>
<div>
<h2 class="text-primary"><?php echo $post["title"]; ?></h2>
<h5><span class="text-danger">Created at: </span><?php echo $post["created"]; ?></h5>
<hr>
<p><i><?php echo $post["body"]; ?></i></p>
</div>
</div>
</body>