-
Notifications
You must be signed in to change notification settings - Fork 1
/
editDiary.php
158 lines (143 loc) · 3.68 KB
/
editDiary.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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<?php
session_start();
if(!isset($_SESSION['u_uid'])){
header("Location: loginpage.php");
exit();
}
include 'includes/dbh.inc.php';
$user_uid = $_SESSION['u_uid'];
$diary_id = $_GET['diary_id'];
$sql = "Select * from diary where user_uid = '$user_uid' AND diary_id='$diary_id'";
$result =mysqli_query($conn,$sql);
$record = mysqli_fetch_assoc($result);
@$message = $_GET['newentry'];
?>
<html>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<head>
<title>Edit Entry</title>
<link rel="icon" type="image/gif/png" href="homelogo.png">
<style>
*{
margin: 0px;
padding: 0px;
}
body {margin:0px;}
button {
margin-left: 11px;
border: 1px blue;
background: blue;
margin-bottom: 7px;
border-radius: 5px;
}
button a{
color: #fff;
text-decoration: none;
}
input{
width: 300px;
margin: 4px;
padding: 2px;
font-size: 14px;
margin-left: 10px;
}
label{
font-size: 18px;
margin-left: 10px;
}
.navbar {
overflow: hidden;
font-size:30px;
background-color: none;
}
.navbar a {
float: left;
font-size: 16px;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
.active {
background-color: green;
color: white;
}
.navbar a:hover {
background-color: blue;
color: #fff;
}
li{
float: left;
list-style: none;
padding: none;
margin: 0px;
}
.a {
border-radius: 25px;
}
.logout{
}
.newentry{
margin-top: 5px;
margin-bottom: 5px;
margin-left: 45%;
text-decoration: none;
font-size: 25px;
}
.newentry:hover{
background: blue;
color: #fff;
border-radius: 20px;
padding: 4px;
}
.block{
width: 200px;
height: 300px;
display: block;
margin: 7px;
float: left;
border: 2px solid;
background: #ffe;
color: #004d99;
text-align: center;
border-radius: 15px;
}
</style>
</head>
<body>
<header>
<img src="logogo.png" style="height:20%;overflow:hidden;width:100%;">
<div class="navbar">
<ul>
<li><a href="home.php" class="a">Home</a></li>
<li><a href="mydiary.php" class="active a">Diary</a></li>
<li><a href="todo.php" class="a">To Do List</a></li>
<li><a href="myimages.php" class="a">My Image</a></li>
<li><a href="feedback.php" class="a">Feedback</a></li>
<li><a href="includes/logout.inc.php" class="a" style="margin-left: 855px;">Logout</a></li>
</ul>
</div>
</header>
<div style="margin-left: 20%;margin-top: 2%">
<h1>Edit Entry</h1>
<form method="post" action="includes/newentry.inc.php">
<label>Title: </label>
<input type="text" style="width:250px;" name="title" value="<?php echo $record['diary_title']; ?>">
<br>
<label>Date: </label>
<input type="text" value="<?php echo $record['diary_date']; ?>" name="date" readonly>
<label>Category:</label>
<select name="category" required style="border-radius: 12px;" value="<?php echo $record['diary_category'];?>">
<option value="family">Family</option>
<option value="friend">Friend</option>
<option value="office">Office</option>
</select>
<br><br>
<textarea name="newentry" maxlength="800" rows="10" cols="70" style="margin-left: 10px;" ><?php echo $record['diary_content'];?></textarea>
<br> <br>
<input type="hidden" name="diary_id" value="<?php echo $diary_id;?>">
<button type="submit" name="save" style="border-radius: 12px; color: #fff; padding: 5px;">Save</button>
</form>
</div>
</body>
</html>