Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!Doctype HTML>
- <html>
- <head>
- <title>Aufgabe 2</title>
- <meta charset="UTF-8">
- <link rel="stylesheet" type="text/css" href="index.css">
- </head>
- <body>
- <h1 style="text-decoration: underline">Mitarbeiter</h1>
- <select name="list" size="15%" style="width: 40%;">
- <?php $c = new Main(); $c->Refresh(); ?>
- </select>
- <br>
- <br>
- <form method="post" action="">
- <a class="inputbox">ID:</a><br> <input type="number" name="id" id="id"><br>
- </form>
- <a class="inputbox" name="forename">Forename:</a><br> <input type="text"><br>
- <a class="inputbox" name="name">Name:</a><br> <input type="text"><br>
- <a class="inputbox" name="city">City:</a><br> <input type="text"><br><br>
- <form method="post" action="">
- <button type="submit" name="sent">Hinzufügen</button>
- </form>
- </body>
- </html>
- <?php
- class Main
- {
- public $servername = "localhost";
- public $username = "admin";
- public $password = "admin";
- public $dbname = "aufgabe02";
- function Refresh()
- {
- $con = new mysqli($this->servername, $this->username, $this->password, $this->dbname);
- if(!$con)
- {
- die("Connection Problem: ". $con->connect_error);
- }
- $sql = "SELECT * FROM aufgabe02.employee";
- $result = $con->query($sql);
- if(!$result)
- {
- die("SQL Problem: ". $con->error);
- }
- if ($result->num_rows > 0)
- {
- while ($row = $result->fetch_assoc())
- {
- $option = $row["id"] . " " . $row["forename"] . " " . $row["name"] . " " . $row["city"];
- echo "<option>" . $option . "</option>";
- }
- }
- $con->close();
- }
- function AddUser($id, $forename, $name, $city)
- {
- }
- }
- if(isset($_POST['sent']))
- {
- $id = $_POST["id"];
- $forename = $_POST["forename"];
- $name = $_POST["name"];
- $city = $_POST["city"];
- echo $id;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement