-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathedit-post.php
50 lines (41 loc) · 1.93 KB
/
edit-post.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
<?php require __DIR__ . '/views/header.php';
isLoggedIn();
$posts = editPost($_GET['id'], $pdo);
?>
<article class="form-box">
<?php foreach ($posts as $post) : ?>
<div class="edit-post-container">
<img class="edit-img" src=" <?php echo 'uploads/' . $post['image_name'] ?> " alt="">
<h3 class="edit-post-title"> <?php echo $post['title']; ?> </h3>
<p class="edit-post-para"> <?php echo $post['content']; ?> </p>
</div>
<?php endforeach; ?>
<h2>Edit your post</h2>
<form action="<?php echo 'app/posts/edit-post.php?id=' . $post['id'] ?> " method="post" enctype="multipart/form-data">
<div>
<label for="image">Change image</label>
<input type="file" name="image" id="image" accept=".jpg, .jpeg, .png" required>
</div>
<div clsss="btn-box">
<button class="edit-btn" type="submit">Edit picture</button></div>
</form>
<form action="<?php echo 'app/posts/edit-post.php?id=' . $post['id'] ?>" method="post">
<div>
<label for="title">Title</label>
<input type="text" name="title" value="<?php echo $post['title']; ?> " required>
<small>Edit your title</small>
</div>
<div>
<label for="content">Description</label>
<textarea class="content-box" type="text" name="content" required> <?php echo $post['content'] ?> </textarea>
<small>Edit your description</small>
</div>
<div clsss="btn-box">
<button class="edit-btn" type="submit">Edit post</button></div>
</form>
<form action="<?php echo 'app/posts/delete-post.php?author_id=' . $post['author_id'] . '&id=' . $post['id'] . '&image=' . $post['image_name'] ?>" method="post">
<div clsss="btn-box">
<button class="warning-btn" type="submit">Delete post</button></div>
</form>
</article>
<?php require __DIR__ . '/views/footer.php'; ?>