Guest User

Untitled

a guest
Jul 24th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.07 KB | None | 0 0
  1. <?php
  2. include_once 'dbconfig.php';
  3. if(isset($_POST['btn-save'])) {
  4. $fname = $_POST['first_name'];
  5. $lname = $_POST['last_name'];
  6. $email = $_POST['email_id'];
  7. $contact = $_POST['contact_no'];
  8.  
  9. if($crud->create($fname, $lname, $email, $contact)) {
  10. header("location: add-data.php?inserted");
  11. } else {
  12. header("location: add-data.php?failure");
  13. }
  14. }
  15. ?>
  16. <?php include_once 'header.php'; ?>
  17. <div class="clearfix"></div>
  18. <?php
  19. if(isset($_GET['inserted'])) {
  20. ?>
  21. <div class="container">
  22. <div class="alert alert-info">
  23. <strong>Yesh!</strong>Successfully inserted<a href="index.php">&nbsp;HOME</a>!
  24. </div>
  25. </div>
  26. <?php
  27. } else if(isset($_GET['failure'])) {
  28. ?>
  29. <div class="container">
  30. <div class="alert alert-warning">
  31. <strong>Opp!</strong>Error while inserting data!
  32. </div>
  33. </div>
  34. <?php
  35. }
  36. ?>
  37. <div class="clearfix"></div><br/>
  38. <div class="container">
  39. <form method="post">
  40. <table class="table table-bordered">
  41. <tr>
  42. <td>First Name</td>
  43. <td><input type="text" name="first_name" class="form-control" required /></td>
  44. </tr>
  45. <tr>
  46. <td>Last Name</td>
  47. <td><input type="text" name="last_name" class="form-control" required /></td>
  48. </tr>
  49. <tr>
  50. <td>E-Mail</td>
  51. <td><input type="text" name="email_id" class="form-control" required /></td>
  52. </tr>
  53. <tr>
  54. <td>Contact No</td>
  55. <td><input type="text" name="contact_no" class="form-control" required /></td>
  56. </tr>
  57. <tr>
  58. <td colspan="2"><button type="submit" class="btn btn-primary" name="btn-save">
  59. <span class="glyphicon glyphicon-plus"></span>Create New Record
  60. </button>
  61. <a href="index.php" class="btn btn-large btn-success"><i class="glyphicon glyphicon-backward"></i>&nbsp;Back to index</a>
  62. </td>
  63. </tr>
  64. </table>
  65. </form>
  66. </div>
  67. <?php include_once 'footer.php'; ?>
Add Comment
Please, Sign In to add comment