Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include_once '../../config/dbconfig.php';
- if(isset($_POST['btn-save']))
- {
- $titulo = $_POST['titulo'];
- $conteudo = $_POST['conteudo'];
- $data = $_POST['data'];
- $img = $_POST['img'];
- if($crudNews->create($titulo,$conteudo,$data,$img))
- {
- header("Location: add-data.php?inserted");
- }
- else
- {
- header("Location: add-data.php?failure");
- }
- }
- ?>
- <?php include_once '../header.php'; ?>
- <div class="clearfix"></div>
- <?php
- if(isset($_GET['inserted']))
- {
- ?>
- <div class="container">
- <div class="alert alert-info">
- <strong>WOW!</strong> Record was inserted successfully <a href="src/noticias/noticias.php">HOME</a>!
- </div>
- </div>
- <?php
- }
- else if(isset($_GET['failure']))
- {
- ?>
- <div class="container">
- <div class="alert alert-warning">
- <strong>SORRY!</strong> ERROR while inserting record !
- </div>
- </div>
- <?php
- }
- ?>
- <div class="clearfix"></div><br />
- <div class="container">
- <form method='post' enctype="multipart/form-data">
- <table class='table table-bordered'>
- <tr>
- <td>Titulo</td>
- <td><input type='text' name='titulo' class='form-control' required></td>
- </tr>
- <tr>
- <td>Conteudo</td>
- <td><input type='text' name='conteudo' class='form-control' required></td>
- </tr>
- <tr>
- <td>Data</td>
- <td><input type='date' name='data' class='form-control' required></td>
- </tr>
- <tr>
- <td>Imagem</td>
- <td><input type='file' name='img' class='form-control' required></td>
- </tr>
- <tr>
- <td colspan="2">
- <button type="submit" class="btn btn-primary" name="btn-save">
- <span class="glyphicon glyphicon-plus"></span> Create New Record
- </button>
- <a href="noticias.php" class="btn btn-large btn-success"><i class="glyphicon glyphicon-backward"></i> Back to index</a>
- </td>
- </tr>
- </table>
- </form>
- </div>
- <?php include_once '../footer.php'; ?>
Advertisement
Add Comment
Please, Sign In to add comment