Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(isset($_POST['submit'])) {
- $title_bg = $_POST['title_bg'];
- $title_en = $_POST['title_en'];
- $body_bg = $_POST['body_bg'];
- $body_en = $_POST['body_en'];
- $image = $_FILES['image']['name'];
- $image_tmp = $_FILES['image']['tmp_name'];
- move_uploaded_file($image_tmp, '../uploads/' . $image);
- $status = $_POST['status'];
- $query = "INSERT INTO posts(title_bg, title_en, body_bg, body_en, image, status, created) ";
- $query .= "VALUES('$title_bg', '$title_en', '$body_bg', '$body_en', '$image', '$status', now())";
- $create_post = mysqli_query($connection, $query);
- header("Location: posts.php");
- }
- ?>
- <form action="" method="post" enctype="multipart/form-data">
- <div class="form-item">
- <label for="title_bg">Post title BG</label>
- <input type="text" name="title_bg">
- </div>
- <div class="form-item">
- <label for="title_en">Post title EN</label>
- <input type="text" name="title_en">
- </div>
- <div class="form-item">
- <label for="body_bg">Post body BG</label>
- <textarea id="editor" name="body_bg" rows="10" cols="30"></textarea>
- </div>
- <div class="form-item">
- <label for="body_en">Post body EN</label>
- <textarea id="editor2" name="body_en" rows="10" cols="30"></textarea>
- </div>
- <div class="form-item">
- <label for="image">Image</label>
- <input type="file" name="image">
- </div>
- <div class="form-item">
- <label for="status">Post status</label>
- <select name="status">
- <option value="published">published</option>
- <option value="draft">draft</option>
- </select>
- </div>
- <div class="form-item">
- <input type="submit" class="form-submit" name="submit" value="Submit">
- </div>
- </form>
- <input type="file" name="image[]" multiple>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement