-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaddPost.php
More file actions
82 lines (76 loc) · 2.62 KB
/
addPost.php
File metadata and controls
82 lines (76 loc) · 2.62 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
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
<?php require_once 'inc/connection.php' ?>
<?php require_once 'inc/function.php' ?>
<?php if(!isset($_SESSION['login']))
header("location:../index.php");
?>
<?php require_once 'inc/header.php' ?>
<!-- Page Content -->
<div class="page-heading products-heading header-text">
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="text-content">
<h4>new Post</h4>
<h2>add new personal post</h2>
</div>
</div>
</div>
</div>
</div>
<?php
/*
if(isset($_SESSION['errors'])){
printErrorArray($_SESSION['errors']);
unset($_SESSION['errors']);
}
*/
/*
if(isset($_SESSION['success'])){
printSuccessMessage($_SESSION['success']);
unset($_SESSION['success']);
}
*/
?>
<div class="container w-50 ">
<div class="d-flex justify-content-center">
<h3 class="my-5">add new Post</h3><h3></h3>
</div>
<form method="POST" action="handle/store.php" enctype="multipart/form-data">
<?php if(isset($_SESSION['success'])){
printSuccessMessage($_SESSION['success']);
unset($_SESSION['success']);
}?>
<div class="mb-3">
<label for="title" class="form-label">Title</label>
<input type="text" class="form-control" id="title" name="title" value="<?php if(isset($_SESSION['title'])) {echo $_SESSION['title']; unset($_SESSION['title']);}?>">
<?php
if(isset($_SESSION['title_error'])):
print_error($_SESSION['title_error']);
unset($_SESSION['title_error']);
endif;
?>
</div>
<div class="mb-3">
<label for="body" class="form-label">Body</label>
<textarea class="form-control" id="body" name="body" rows="5" ><?php if(isset($_SESSION['body'])) echo $_SESSION['body']?></textarea>
<?php
if(isset($_SESSION['body_error'])):
print_error($_SESSION['body_error']);
unset($_SESSION['body_error']);
endif;
?>
</div>
<div class="mb-3">
<label for="image" class="form-label">image</label>
<input type="file" class="form-control-file" id="image" name="image" >
<?php
if(isset($_SESSION['image_error'])):
print_error($_SESSION['image_error']);
unset($_SESSION['image_error']);
endif;
?>
</div>
<button type="submit" class="btn btn-primary" name="add">Add post</button>
</form>
</div>
<?php require_once 'inc/footer.php' ?>