valodia

add-data

Mar 11th, 2016
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.08 KB | None | 0 0
  1. <?php
  2. include_once '../../config/dbconfig.php';
  3.  
  4. if(isset($_POST['btn-save']))
  5. {
  6. $titulo = $_POST['titulo'];
  7. $conteudo = $_POST['conteudo'];
  8. $data = $_POST['data'];
  9. $img = $_POST['img'];
  10.  
  11. if($crudNews->create($titulo,$conteudo,$data,$img))
  12. {
  13. header("Location: add-data.php?inserted");
  14. }
  15. else
  16. {
  17. header("Location: add-data.php?failure");
  18. }
  19. }
  20. ?>
  21. <?php include_once '../header.php'; ?>
  22. <div class="clearfix"></div>
  23.  
  24. <?php
  25. if(isset($_GET['inserted']))
  26. {
  27. ?>
  28. <div class="container">
  29. <div class="alert alert-info">
  30. <strong>WOW!</strong> Record was inserted successfully <a href="src/noticias/noticias.php">HOME</a>!
  31. </div>
  32. </div>
  33. <?php
  34. }
  35. else if(isset($_GET['failure']))
  36. {
  37. ?>
  38. <div class="container">
  39. <div class="alert alert-warning">
  40. <strong>SORRY!</strong> ERROR while inserting record !
  41. </div>
  42. </div>
  43. <?php
  44. }
  45. ?>
  46.  
  47. <div class="clearfix"></div><br />
  48.  
  49. <div class="container">
  50.  
  51.  
  52. <form method='post' enctype="multipart/form-data">
  53.  
  54. <table class='table table-bordered'>
  55.  
  56. <tr>
  57. <td>Titulo</td>
  58. <td><input type='text' name='titulo' class='form-control' required></td>
  59. </tr>
  60.  
  61. <tr>
  62. <td>Conteudo</td>
  63. <td><input type='text' name='conteudo' class='form-control' required></td>
  64. </tr>
  65.  
  66. <tr>
  67. <td>Data</td>
  68. <td><input type='date' name='data' class='form-control' required></td>
  69. </tr>
  70.  
  71. <tr>
  72. <td>Imagem</td>
  73. <td><input type='file' name='img' class='form-control' required></td>
  74. </tr>
  75.  
  76. <tr>
  77. <td colspan="2">
  78. <button type="submit" class="btn btn-primary" name="btn-save">
  79. <span class="glyphicon glyphicon-plus"></span> Create New Record
  80. </button>
  81. <a href="noticias.php" class="btn btn-large btn-success"><i class="glyphicon glyphicon-backward"></i> &nbsp; Back to index</a>
  82. </td>
  83. </tr>
  84.  
  85. </table>
  86. </form>
  87.  
  88.  
  89. </div>
  90.  
  91. <?php include_once '../footer.php'; ?>
Advertisement
Add Comment
Please, Sign In to add comment