Advertisement
Guest User

Untitled

a guest
Jul 1st, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. <?php
  2. if(isset($_POST['submit'])) {
  3. $title_bg = $_POST['title_bg'];
  4. $title_en = $_POST['title_en'];
  5. $body_bg = $_POST['body_bg'];
  6. $body_en = $_POST['body_en'];
  7. $image = $_FILES['image']['name'];
  8. $image_tmp = $_FILES['image']['tmp_name'];
  9.  
  10. move_uploaded_file($image_tmp, '../uploads/' . $image);
  11.  
  12. $status = $_POST['status'];
  13.  
  14.  
  15. $query = "INSERT INTO posts(title_bg, title_en, body_bg, body_en, image, status, created) ";
  16. $query .= "VALUES('$title_bg', '$title_en', '$body_bg', '$body_en', '$image', '$status', now())";
  17.  
  18. $create_post = mysqli_query($connection, $query);
  19.  
  20. header("Location: posts.php");
  21. }
  22. ?>
  23.  
  24. <form action="" method="post" enctype="multipart/form-data">
  25. <div class="form-item">
  26. <label for="title_bg">Post title BG</label>
  27. <input type="text" name="title_bg">
  28. </div>
  29.  
  30. <div class="form-item">
  31. <label for="title_en">Post title EN</label>
  32. <input type="text" name="title_en">
  33. </div>
  34.  
  35. <div class="form-item">
  36. <label for="body_bg">Post body BG</label>
  37. <textarea id="editor" name="body_bg" rows="10" cols="30"></textarea>
  38. </div>
  39.  
  40. <div class="form-item">
  41. <label for="body_en">Post body EN</label>
  42. <textarea id="editor2" name="body_en" rows="10" cols="30"></textarea>
  43. </div>
  44.  
  45. <div class="form-item">
  46. <label for="image">Image</label>
  47. <input type="file" name="image">
  48. </div>
  49.  
  50. <div class="form-item">
  51. <label for="status">Post status</label>
  52. <select name="status">
  53. <option value="published">published</option>
  54. <option value="draft">draft</option>
  55. </select>
  56. </div>
  57.  
  58. <div class="form-item">
  59. <input type="submit" class="form-submit" name="submit" value="Submit">
  60. </div>
  61. </form>
  62.  
  63. <input type="file" name="image[]" multiple>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement