Guest User

Untitled

a guest
May 5th, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.54 KB | None | 0 0
  1. <?php
  2. session_start();
  3. ?>
  4.  
  5. <html>
  6.  
  7. <head>
  8. <meta charset="utf-8">
  9. <title>Delete a Record</title>
  10. </head>
  11.  
  12. <body>
  13. <form action="delete_table_handler.php" method="post">
  14. <table border="0">
  15. <tr>
  16. <td>
  17. <select name="table">
  18. <option value="Animals">Animals</option>
  19. <option value="Characters">Characters</option>
  20. <option value="Chimeras">Chimeras</option>
  21. <option value="Cities">Cities</option>
  22. <option value="Countries">Countries</option>
  23. <option value="Races">Races</option>
  24. </select>
  25. </td>
  26. <tr>
  27. <tr>
  28. <td>
  29. <input type="submit" value="Select a Record">
  30. </td>
  31. <tr>
  32. </table>
  33. </form>
  34. <body>
  35. </html>
  36.  
  37. <?php
  38. session_start();
  39.  
  40.  
  41. $_SESSION["table"] = $_POST["table"];
  42. $_SESSION["table"] = addslashes($_SESSION["table"]);
  43.  
  44. header("Location: delete_record.php")
  45.  
  46. ?>
  47.  
  48. <?php
  49. session_start();
  50. ?>
  51.  
  52. <html>
  53.  
  54. <head>
  55. <meta charset="utf-8">
  56. <title>Delete a Record</title>
  57. </head>
  58.  
  59. <body>
  60. <?php
  61. echo "<p>".$_SESSION["table"]."</p>"
  62. ?>
  63. <form action="delete_record_handler.php" method="post">
  64. <table border="0">
  65. <tr>
  66. <td>
  67. <select name="record">
  68. <?php
  69.  
  70. $servername = "localhost";
  71. $username = "id5347670_userid";
  72. $password = "password";
  73. $dbname = "id5347670_chwikidb";
  74.  
  75. $conn = new mysqli($servername, $username, $password, $dbname);
  76. if ($conn->connect_error) {
  77. die("Connection failed: " . $conn->connect_error);
  78. }
  79. $sql = "SELECT name FROM '".$_SESSION["table"]."'";
  80. $result = $conn->query($sql);
  81. while($row = $result->fetch_assoc()) {
  82. echo "<option value='".$row["name"]."'>".$row["name"]."</option>";
  83. }
  84. ?>
  85. </select>
  86. </td>
  87. <tr>
  88. <tr>
  89. <td>
  90. <input type="submit" value="Select a Record"/>
  91. </td>
  92. <tr>
  93. </table>
  94. </form>
  95. <body>
  96.  
  97. </html>
Add Comment
Please, Sign In to add comment