-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_post.php
More file actions
71 lines (65 loc) · 2.97 KB
/
create_post.php
File metadata and controls
71 lines (65 loc) · 2.97 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
<?php
require_once './header.php';
if (isset($_POST['post_btn_submit'])) {
$request = new PostRequest($_POST);
Post::create($connection, $request);
if(Auth::user()->user_type== 'admin') {
redirect('admin');
}else {
redirect('posts');
}
}
?>
<section class="section">
<div class="section-body">
<div class="row">
<div class="col-12">
<div class="card mb-0">
<div class="card-body">
<h4 class="m-0">Create Post</h4>
</div>
</div>
</div>
</div>
<div class="row mt-4">
<div class="col-12">
<div class="card">
<div class="card-body">
<form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<input type="hidden" name="author" value="<?php echo $_SESSION['user']->firstname?>">
<div class="form-group row mb-4">
<label class="col-form-label text-md-right col-12 col-md-3 col-lg-3">Title</label>
<div class="col-sm-12 col-md-7">
<input type="text" class="form-control" name="title">
</div>
</div>
<div class="form-group row mb-4">
<label class="col-form-label text-md-right col-12 col-md-3 col-lg-3">Category</label>
<div class="col-sm-12 col-md-7">
<select class="form-control" name="category">
<option>Tech</option>
<option>News</option>
<option>Political</option>
</select>
</div>
</div>
<div class="form-group row mb-4">
<label class="col-form-label text-md-right col-12 col-md-3 col-lg-3">Content</label>
<div class="col-sm-12 col-md-7">
<textarea class="summernote-simple" name="body"></textarea>
</div>
</div>
<div class="form-group row mb-4">
<label class="col-form-label text-md-right col-12 col-md-3 col-lg-3"></label>
<div class="col-sm-12 col-md-7">
<button type="submit" class="btn btn-primary" name="post_btn_submit">Create Post</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</section>
<?php include './footer.php'; ?>