Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>Benutzer Aktivität</title>
- <meta charset="utf-8" />
- </head>
- <body>
- <?php
- include("Parametres.php");
- // Connecting to the MySQL server
- $mysqli=mysqli_connect($host,$user,$pass) or die("Problem of connection to the MySQL server :".mysqli_error());
- // Creating the database
- //query($mysqli,'CREATE DATABASE IF NOT EXISTS '.$base);
- // Selecting the database
- mysqli_select_db($mysqli,$base) or die("Selection of the database failed! : $base");
- //Darstellung der Zutaten Tabelle für die Auswahl
- //Auswahl Zutaten aus Kategorie? ("obst_gemüse","alkohol","saft_sirup","sonstige")
- //Speichern in der Datenbank als neue/eigene Cocktail
- # execute search query
- $query = 'SELECT * FROM `DetailsCategory`';
- $result = mysqli_query($mysqli, $query);
- # check result
- if (!$result)
- die('Could not successfully run query: ' . mysqli_connect_error());
- # display returned data
- if (mysqli_num_rows($result) > 0)
- {
- ?>
- <form action="" method="post">
- <table border = "1" align = "center" style="line-height:25px;">
- <tr>
- <th>Auswahl</th>
- <th>Id</th>
- <th>Obst/Gemuese</th>
- <th>Alkohol</th>
- <th>Saft/Sirup</th>
- <th>Sonstige</th>
- <th>Datum</th>
- <?php
- while ($row = mysqli_fetch_assoc($result))
- {
- echo '<tr><td>';
- echo '<input type="checkbox" name="selected[]" value="'.$row['id'].': '.$row['obst_gemuese'].', '.$row['alkohol'].', '.$row['saft_sirup'].', '.$row['sonstige'].'"/>';
- echo '</td>';
- foreach ($row as $key => $value)
- echo '<td>'.htmlspecialchars($value).'</td>';
- echo '</tr>';
- }
- ?>
- </table>
- <!-- <input type="submit"/> -->
- <input type = "submit" name = "submit" value = "Submit" />
- <?php
- if(isset($_POST['submit'])){
- if(!empty($_POST['selected'])) {
- // Counting number of checked checkboxes.
- $checked_count = count($_POST['selected']);
- echo "Sie haben folgende ".$checked_count." Zutaten(s) ausgewählt: <br/>";
- // Loop to store and display values of individual checked checkbox.
- foreach($_POST['selected'] as $selected) {
- echo "<p>".$selected ."</p>";
- }
- }
- }
- ?>
- </form>
- <?php
- }
- else
- echo '<p>No data</p>';
- # free resources
- mysqli_free_result($result);
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement