-
Notifications
You must be signed in to change notification settings - Fork 15
/
add_article.php
109 lines (79 loc) · 3.7 KB
/
add_article.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
<!-- Include Head -->
<?php include "assest/head.php"; ?>
<?php
$stmt = $conn->prepare("SELECT category_id, category_name FROM category");
$stmt->execute();
$categories = $stmt->fetchAll();
$stmt = $conn->prepare("SELECT author_id, author_fullname FROM author");
$stmt->execute();
$authors = $stmt->fetchAll();
?>
<!-- JS TextEditor -->
<script src="//cdn.ckeditor.com/4.13.1/standard/ckeditor.js"></script>
<title>Add Article</title>
</head>
<body>
<!-- Header -->
<?php include "assest/header.php" ?>
<!-- Main -->
<main role="main" class="main">
<div class="jumbotron text-center ">
<h1 class="display-3 font-weight-normal text-muted">Submit an Article</h1>
</div>
<div class="container">
<div class="row">
<div class="col-lg-12 mb-4">
<!-- Form -->
<form action="assest/insert.php?type=article" method="POST" enctype="multipart/form-data">
<div class="form-group">
<label for="arTitle">Title</label>
<input type="text" class="form-control" name="arTitle" id="arTitle" required>
</div>
<div class="form-group">
<label for="arContent">Content</label>
<textarea class="form-control" name="arContent" id="arContent" rows="3" required></textarea>
</div>
<div class="form-group">
<label for="arImage">Image</label>
<div class="custom-file">
<input type="file" class="custom-file-input" name="arImage" id="arImage">
<label class="custom-file-label" for="arImage">Choose file</label>
</div>
</div>
<div class="form-group">
<label for="arCategory">Category</label>
<select class="custom-select" name="arCategory" id="arCategory" required>
<option disabled>-- Select Category --</option>
<?php foreach ($categories as $category) : ?>
<option value="<?= $category['category_id'] ?>"><?= $category['category_name'] ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="form-group">
<label for="arAuthor">Author</label>
<select class="custom-select" name="arAuthor" id="arAuthor" required>
<option disabled>-- Select Author --</option>
<?php foreach ($authors as $author) : ?>
<option value="<?= $author['author_id'] ?>"><?= $author['author_fullname'] ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="text-center">
<button type="submit" name="submit" class="btn btn-success btn-lg w-25">Submit</button>
</div>
</form>
</div>
<!-- <div class="col-lg-4 mb-4">
<h1> Random Articles </h1>
</div> -->
</div>
</div>
</main>
<!-- Footer -->
<!-- <?php include "assest/footer.php" ?> -->
<!-- Text Editor Script -->
<script>
CKEDITOR.replace('arContent');
</script>
</body>
</html>