Nikita

Nikita

  • 1.9k
  • 49
  • 1.4k

the value can not store in the database.

Feb 18 2020 3:09 AM
  1. <?php  
  2. session_start();  
  3. include "connection.php";  
  4. include "header.php";  
  5. ?>  
  6.   
  7. <!-- page content area main -->  
  8. <div class="right_col" role="main">  
  9. <div class="">  
  10. <div class="page-title">  
  11. <div class="title_left">  
  12. <h3>Plain Page</h3>  
  13. </div>  
  14.   
  15. <div class="title_right">  
  16. <div class="col-md-5 col-sm-5 col-xs-12 form-group pull-right top_search">  
  17. <div class="input-group">  
  18. <input type="text" class="form-control" placeholder="Search for...">  
  19. <span class="input-group-btn">  
  20. <button class="btn btn-default" type="button">Go!</button>  
  21. </span>  
  22. </div>  
  23. </div>  
  24. </div>  
  25. </div>  
  26.   
  27. <div class="clearfix"></div>  
  28. <div class="row" style="min-height:500px">  
  29. <div class="col-md-12 col-sm-12 col-xs-12">  
  30. <div class="x_panel">  
  31. <div class="x_title">  
  32. <h2>Add Books Info</h2>  
  33.   
  34. <div class="clearfix"></div>  
  35. </div>  
  36. <div class="x_content">  
  37. <form name="form1" action="" method="post" class="col-lg-6">  
  38. <table class="table">  
  39. <tr>  
  40. <td><input type="text" placeholder="Books Name" class="form-control" name="booksname" required=""> </td>  
  41. </tr>  
  42. <tr>  
  43. <td>Books Image<input type="file" name="f1" class="form-control" required=""></td>  
  44. </tr>  
  45. <tr>  
  46. <td><input type="text" placeholder="Books Author Name" name="author" class="form-control" required=""></td>  
  47. </tr>  
  48. <tr>  
  49. <td><input type="text" placeholder="Books Publication Name" name="publication" class="form-control" required=""></td>  
  50. </tr>  
  51. <tr>  
  52. <td><input type="text" placeholder="Books Purchase Date" name="bpurchasedt" class="form-control" required=""></td>  
  53. </tr>  
  54.   
  55. <tr>  
  56. <td><input type="text" placeholder="Books Price" name="price" class="form-control" required=""></td>  
  57. </tr>  
  58. <tr>  
  59. <td><input type="text" placeholder="Books Quantity" name="bqty" class="form-control" required=""></td>  
  60. </tr>  
  61. <tr>  
  62. <td><input type="text" placeholder="Available Quantity" name="aqty" class="form-control" required=""></td>  
  63. </tr>  
  64. <tr>  
  65. <td><input type="submit" name="submit1" class="btn btn-default submit" value="Insert Books Details" style="font-size: 16px;  
  66. font-weight: bold;  
  67. color: black; width:100%;background-color:blue;"></td>  
  68. </tr>  
  69.   
  70. </table>  
  71. </form>  
  72. </div>  
  73. </div>  
  74. </div>  
  75. </div>  
  76. </div>  
  77. </div>  
  78. <!-- /page content -->  
  79.   
  80. <?php  
  81. if(isset($_POST["submit1"]))  
  82. {  
  83. $tm=md5(time());  
  84. $fnm=$_FILES["f1"]["name"];  
  85. $dst=".books_image/.".$tm.$fnm;  
  86. $dst1="books_image/" .$tm.$fnm;  
  87. move_uploaded_file($_FILES["f1"]["tmp_name"],$dst);  
  88. mysqli_query($link"insert into add_books values ('','$_POST[booksname]','$dst1','$_POST[author]','$_POST[publication]','$_POST[bpurchasedt]','$_POST[price]','$_POST[bqty]','$_POST[aqty]','$_SESSION[librarian]')");  
  89. ?>  
  90.   
  91. <script type="text/javascript">  
  92. alert("Books Inserted Successfully");  
  93. </script>  
  94. <?php  
  95. }  
  96. ?>  
  97. <?php  
  98. include "footer.php";  
  99. ?>