Ich habe ein "kleines" eigenes CMS gebaut und wenn ich den Eintrag erstellen will passiert nichts
Kann mir einer helfen?
Code
class ARTICLE
{
function __construct()
{
# code...
}
public static function create()
{
global $connection;
if (isset($_POST['create_post'])) {
$post_publish = date('d-m-y H:i:s', strtotime($_POST['date2']));
echo $post_publish;
$post_title = $_POST['title'];
$post_author = $_POST['author'];
$post_category_id = $_POST['post_category_id'];
$post_status = $_POST['post_status'];
$post_image = $_FILES['image']['name'];
$post_image_temp = $_FILES['image']['tmp_name'];
$post_tags = $_POST['post_tags'];
$post_teaser = $_POST['post_teaser'];
$post_content = $_POST['post_content'];
$post_comment_count = 4;
move_uploaded_file($post_image_temp, "../images/$post_image");
$post_query = "INSERT INTO posts (post_category_id, post_title, post_author,post_publish, post_image,post_comment_count, post_status,post_teaser,post_content) VALUES('$post_category_id', '$post_title', '$post_author','$post_publish', '$post_image', '$post_tags', '$post_comment_count', '$post_status','$post_teaser', '$post_content')";
$stmt = mysqli_query($connection, $post_query);
if ($stmt) {
echo "<div class='alert alert-success'>Artikel erfolgreich erstellt!</div>";
}
}
}
}
Alles anzeigen
PHP
<div class="col-lg-12">
<?php
ARTICLE::create();
?>
<div class="col-lg-6">
<form class="" action="" method="post" enctype="multipart/form-data">
<div class="form-group">
<label for="title">Titel</label>
<input type="text" class="form-control" name="title">
</div>
<div class="form-group">
<label for="post_category">Artikel Kategorie</label>
<input type="text" class="form-control" name="post_category_id">
</div>
<div class="form-group">
<label for="title">Author</label>
<input type="text" class="form-control" name="author">
</div>
<div class="form-group">
<label for="post_status">Status</label>
<input type="text" class="form-control" name="post_status">
</div>
<div class="form-group">
<label for="post_image">Bild</label>
<input type="file" name="image">
</div>
<div class="form-group">
<label for="post_image">Erscheinungsdatum/Zeit</label>
<input type="text" id="date2" name="date2" value="">
</div>
<div class="form-group">
<label for="post_tags">Tags</label>
<input type="text" class="form-control" name="post_tags">
</div>
<div class="form-group">
<label for="title">Teaser</label>
<textarea name="post_teaser" class="form-control">
</textarea>
</div>
<div class="form-group">
<label for="title">Text</label>
<textarea name="post_content" class="form-control" rows="10" cols="30">
</textarea>
</div>
<div class="input-group">
<button type="submit" class="btn btn-primary" name="create_post">Erstellen</button>
</div>
</form>
</div>
</div>
Alles anzeigen