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%;">
- </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>
- <?php Refresh(); ?>
- </body>
- </html>
- <?php
- $servername = "localhost";
- $username = "admin";
- $password = "admin";
- $dbname = "aufgabe02";
- function Refresh()
- {
- global $servername;
- global $username;
- global $password;
- global $dbname;
- $con = new mysqli($servername, $username, $password, $dbname);
- if(!$con)
- {
- die("Connection Problem: ". $con->connect_error);
- }
- $sql = "SELECT * FROM aufgabe02.employee";
- $result = $con->query($sql);
- if(!$result)
- {
- echo "Error: ". $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>";
- }
- }
- else{
- echo "<option>LEER</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";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement