-
Notifications
You must be signed in to change notification settings - Fork 0
/
create.php
46 lines (33 loc) · 1.06 KB
/
create.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
<?php
session_start();
if(! isset($_SESSION['loggedin']))
exit('akses dilarang, silahkan login dulu');
include_once('config.php');
$judul = "Tambah Post";
$subjudul = "";
$url_banner = "assets/img/home-bg.jpg";
if(isset($_POST['submit'])){
$judul = $_POST['judul'];
$konten = $_POST['konten'];
$query = mysqli_query($mysqli, 'INSERT INTO posts (judul, konten) VALUES ("'.$judul.'" , "'.$konten.'")');
if($query){
header('Location: index.php');
}else{
$error = "Error : " . mysqli_error($mysqli);
}
}
?>
<?php include('header.php'); ?>
<!-- Main Content -->
<div class="container">
<form action="create.php" method="post">
<label >Judul Artikel</label>
<input type="text" name="judul" class="form-control">
<br>
<label>Isi Artikel</label>
<textarea name="konten" class="form-control"></textarea>
<hr>
<button type="submit" name="submit" value="submit">Submit Artikel</button>
</form>
</div>
<?php include('footer.php'); ?>