Advertisement
Guest User

Untitled

a guest
Feb 28th, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.08 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3.  
  4. <head>
  5. <title>Baat Database - Query</title>
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <meta charset="utf-8">
  8. <link rel="stylesheet" type="text/css" href="css/main.css">
  9. <link rel="shortcut icon" href="favicon.png">
  10. <style>
  11. #querytable {
  12. height: 500px;
  13. border: solid #2E615D 10px;
  14. width: 65%;
  15. text-align: center;
  16. color: black;
  17. background-color: white;
  18. font-family: futura;
  19. margin: 150px 250px;
  20. min-width: 250px;
  21. }
  22.  
  23. #querytable table {
  24. position: relative;
  25. left: 15%;
  26. }
  27.  
  28. #querytable h3 {
  29. color: white;
  30. background-color: #2E615D;
  31. margin: none;
  32. padding-top: 25px;
  33.  
  34. }
  35. ul {
  36. width: 100vw;
  37. height: 11vh;
  38. padding-top: 10px;
  39. padding-bottom: 25px;
  40. background-color: #2E615D;
  41. margin: auto;
  42. }
  43. li {
  44. list-style-type: none;
  45. float: left;
  46. height: 50px;
  47. width: 25%;
  48. color: white;
  49. font-family: futura;
  50. font-size: 30px;
  51. margin-left: 60px;
  52. padding: 15px 15px;
  53. }
  54.  
  55. li:hover {
  56. background-color: #28544B;
  57. height: 100%;
  58. }
  59. body {
  60. margin: auto;
  61. }
  62.  
  63. p {
  64. position: relative;
  65. top: 250px;
  66. width: 700px;
  67. padding-left: 25vw;
  68. text-align: center;
  69. font-family: futura;
  70. font-size: 24px;
  71. color: white;
  72. }
  73.  
  74. a {
  75. color: white;
  76. text-decoration: none;
  77. }
  78.  
  79. @media screen and (max-width: 1080px) {
  80. ul {
  81. height: 22vh;
  82. }
  83. p {
  84. font-size-adjust: 0.50%;
  85. }
  86. }
  87. th {
  88. padding-left: 0px;
  89. }
  90.  
  91. table {
  92. font-family: arial, sans-serif;
  93. border-collapse: collapse;
  94. width: 100%;
  95. color: black;
  96. background-color: white;
  97. }
  98.  
  99. td, th {
  100. border: 1px solid #dddddd;
  101. text-align: left;
  102. padding: 8px;
  103. }
  104.  
  105. tr:nth-child(even) {
  106. background-color: #dddddd;
  107. }
  108.  
  109. </style>
  110. </head>
  111.  
  112. <body style="background-color: #28544B; ">
  113. <div id="menu" style="height: 150px;">
  114. <ul style="height: 135px;">
  115. <li><a href="index.php">Home</a></li>
  116. <li><a href="kobling.php">Kobling</li>
  117. <li><a href="fjell_m.php?fjell_id='M'">Fjelltur med M</li>
  118. <li><a href="legginn.php">Legg Inn</li>
  119. </ul>
  120. </div>
  121. <div id="paragraf">
  122. <!-- <p style="margin-top: 8.5%">Query SQL</p> -->
  123. </div>
  124. <?php
  125. if(isset($_POST["leggtil"]))
  126. // Creating Variables for server connection
  127. $servername = "localhost";
  128. $username = "root";
  129. $password = "root";
  130. $dbname = "fjelltur";
  131.  
  132. // Create connection
  133. $conn = new mysqli($servername, $username, $password, $dbname);
  134. // Check connection
  135. if ($conn->connect_error) {
  136. die("Connection failed: " . $conn->connect_error);
  137. // Charset
  138. $conn->set_charset("utf8");
  139. //Lagrer skjemafeltene i enklere navnet
  140. $fjell = $_POST["fjell"];
  141. $moh = $_POST["moh"];
  142. $sql = "INSERT INTO fjell (fjell, moh) VALUES ('$fjell', '$moh')";
  143.  
  144. }
  145. $conn->close();
  146. ?>
  147.  
  148. <form method="POST" style="margin-top: 10%; margin-left: 28.5%">
  149. Fjell
  150. <input type="text" name="fjell">
  151. Meter over Havet
  152. <input type="text" name="moh">
  153. <input type="submit" name="leggtil" value="Legg til">
  154. </form>
  155.  
  156. </body>
  157. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement