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 Refresh(); ?>
- </select>
- <br>
- <br>
- <a class="inputbox" name="id">ID:</a><br> <input type="number"><br>
- <form method="post" action="">
- <a class="inputbox" name="forename">Forename:</a><br> <input type="text"><br>
- </form>
- <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
- $servername = "localhost";
- $username = "user";
- $password = "admin";
- $dbname = "aufgabe_02";
- $con = new mysqli($servername, $username, $password, $dbname);
- function Refresh()
- {
- global $con;
- $query = "SELECT * FROM employee";
- if($con->connect_error)
- {
- die("Connection Problem: ". $con->connect_error);
- }
- $result = $con->query($query);
- 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)
- {
- global $con;
- if($con->connect_error)
- {
- die("Connection Problem: ". $con->connect_error);
- }
- echo $forename;
- }
- if(isset($_POST['sent']))
- {
- echo "moin";
- }
- ?>
Add Comment
Please, Sign In to add comment