Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title>Baat Database - Query</title>
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <meta charset="utf-8">
- <link rel="stylesheet" type="text/css" href="css/main.css">
- <link rel="shortcut icon" href="favicon.png">
- <style>
- #querytable {
- height: 500px;
- border: solid #2E615D 10px;
- width: 65%;
- text-align: center;
- color: black;
- background-color: white;
- font-family: futura;
- margin: 150px 250px;
- min-width: 250px;
- }
- #querytable table {
- position: relative;
- left: 15%;
- }
- #querytable h3 {
- color: white;
- background-color: #2E615D;
- margin: none;
- padding-top: 25px;
- }
- ul {
- width: 100vw;
- height: 11vh;
- padding-top: 10px;
- padding-bottom: 25px;
- background-color: #2E615D;
- margin: auto;
- }
- li {
- list-style-type: none;
- float: left;
- height: 50px;
- width: 25%;
- color: white;
- font-family: futura;
- font-size: 30px;
- margin-left: 60px;
- padding: 15px 15px;
- }
- li:hover {
- background-color: #28544B;
- height: 100%;
- }
- body {
- margin: auto;
- }
- p {
- position: relative;
- top: 250px;
- width: 700px;
- padding-left: 25vw;
- text-align: center;
- font-family: futura;
- font-size: 24px;
- color: white;
- }
- a {
- color: white;
- text-decoration: none;
- }
- @media screen and (max-width: 1080px) {
- ul {
- height: 22vh;
- }
- p {
- font-size-adjust: 0.50%;
- }
- }
- th {
- padding-left: 0px;
- }
- table {
- font-family: arial, sans-serif;
- border-collapse: collapse;
- width: 100%;
- color: black;
- background-color: white;
- }
- td, th {
- border: 1px solid #dddddd;
- text-align: left;
- padding: 8px;
- }
- tr:nth-child(even) {
- background-color: #dddddd;
- }
- </style>
- </head>
- <body style="background-color: #28544B; ">
- <div id="menu" style="height: 150px;">
- <ul style="height: 135px;">
- <li><a href="index.php">Home</a></li>
- <li><a href="kobling.php">Kobling</li>
- <li><a href="fjell_m.php?fjell_id='M'">Fjelltur med M</li>
- <li><a href="legginn.php">Legg Inn</li>
- </ul>
- </div>
- <div id="paragraf">
- <!-- <p style="margin-top: 8.5%">Query SQL</p> -->
- </div>
- <?php
- if(isset($_POST["leggtil"]))
- // Creating Variables for server connection
- $servername = "localhost";
- $username = "root";
- $password = "root";
- $dbname = "fjelltur";
- // Create connection
- $conn = new mysqli($servername, $username, $password, $dbname);
- // Check connection
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- // Charset
- $conn->set_charset("utf8");
- //Lagrer skjemafeltene i enklere navnet
- $fjell = $_POST["fjell"];
- $moh = $_POST["moh"];
- $sql = "INSERT INTO fjell (fjell, moh) VALUES ('$fjell', '$moh')";
- }
- $conn->close();
- ?>
- <form method="POST" style="margin-top: 10%; margin-left: 28.5%">
- Fjell
- <input type="text" name="fjell">
- Meter over Havet
- <input type="text" name="moh">
- <input type="submit" name="leggtil" value="Legg til">
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement