-
Notifications
You must be signed in to change notification settings - Fork 0
/
note.php
70 lines (49 loc) · 1.51 KB
/
note.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
<?php
include 'includes/connection.php';
session_start();
if(!isset($_SESSION['nick_name'])){
header("Location: login.php");
}
$id = $_GET['id'];
$query = mysqli_query($conn, "SELECT * FROM notes WHERE id ='$id'");
$notes = mysqli_fetch_array($query);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0 ,maximum-scale=1">
<meta charset="UTF-8">
<title>Notes</title>
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>
<nav>
<div>
<h2 class="big-hero-text"><?php echo ucfirst($_SESSION['nick_name']). " ";?>Notes App </h2>
</div>
</nav>
<h1><a href="notes.php"><i class="fa fa-undo" aria-hidden="true"></i></a></h1>
<div class="single_note">
<h1> <?php echo $notes['name']; ?></h1>
<h3> <?php echo $notes['note']; ?></h3>
<p> <?php echo $notes['date_created']; ?></p>
</div>
<?php if(isset($_POST['delete_button'])){
$id = $_GET['id'];
$query = mysqli_query($conn, "DELETE FROM notes WHERE id ='$id'");
header("Location: notes.php?alert=deleted");
}
?>
<div class="forms">
<div class="delete-form">
<form action='<?php echo "note.php?id=".$notes['id']; ?>' method="POST">
<input class="delete" type="submit" name="delete_button" value="Delete">
</form>
</div>
<div class="edit-form">
<a class="edit" href="<?php echo "edit.php?id=".$notes['id']; ?>">Edit</a>
</div>
</div>
</body>
</html>