Advertisement
Hydrase

Insert.php

Jun 7th, 2025
15
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. <html>
  2. <?php
  3. if(isset($_GET["bid"]) || isset($_GET["auth"]) || isset($_GET["tit"]))
  4. {
  5. $bid=$_GET["bid"];
  6. $auth=$_GET["auth"];
  7. $tit=$_GET["tit"];
  8.  
  9. $db=mysqli_connect("localhost","root","","BOOKS");
  10. $sql="insert into book_details(BOOKID,AUTHOR,TITLE) values($bid,'$auth','$tit')";
  11. if($db->query($sql)===TRUE)
  12. {
  13. echo"<br>Record inserted successfully!";
  14. }
  15. else
  16. {
  17. echo"<br>Error: ".$sql."<br>".$db->error;
  18. }
  19. }
  20. ?>
  21. <body>
  22. <form action="<?php $_PHP_SELF ?>" method="GET">
  23. BOOK ID:<input type="int" name="bid"><br>
  24. AUTHOR:<input type="text" name="auth"><br>
  25. TITLE:<input type="text" name="tit"><br>
  26. <input type="submit" name="submit">
  27. </form>
  28. <a href="index.php">go back</a>
  29. </body>
  30. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement