Hallo zusammen,
ich habe mit HTML eine Tabelle erstellt, die durch Links auf verschiedene Webseiten verweist. Durch ein Drop-Down-Menü soll diese Tabelle nun gefiltert werden und nur noch die Zeilen angezeigt werden, die zu der Auswahl des Formulars passen. Zur Zeit bleibt die Tabelle noch auf der Seite und über der Tabelle kommt eine weitere Tabelle mit den Ausgaben.
Hier ist mein Quelltext:
<?php include("includes/header.php");?>
<body>
<h1>Die 20 besten Cocktailrezepte</h1>
<article>
<header>
<p>Nun geht's los: Verschaff dir einen Überblick über unsere fantastische und einzigartige Cocktailauswahl! Ein Klick auf den Cocktail bringt dich deinem Partyabend einen Schritt näher.</p>
</header>
<?php include("includes/nav.php");?>
<section>
<img src="bilder/bar.jpg" width="350" height="180" alt="Bildbar">
<img src="bilder/haengematte.jpg" width="350" height="180" alt="Bildhängematte">
<img src="bilder/kiwi.jpg" width="350" height="180" alt="Bildkiwi">
<h3>Cocktailtabelle</h3>
<form action="" method="post" name="register">
Wähle deinen Geschmack aus und finde heraus, welche Cocktails für dich passen! Anschließend kannst du in der Tabelle auf deinen Cocktail klicken und das Rezept öffnen!<br/><br/>
Geschmacksrichtung:
<select name="Geschmack" size="1">
<option value="0"> Wähle deinen Geschmack! </option>
<option value="1"> scharf</option>
<option value="2"> aromatisch </option>
<option value="3"> würzig </option>
<option value="4"> süß </option>
<option value="5"> sauer </option>
<option value="6"> erfrischend</option>
<option value="7"> sahnig </option>
<option value="8"> fruchtig </option>
<option value="9"> herb </option>
<option value="10"> prickelnd </option>
<option value="11"> cremig </option>
</select>
<input type="submit" value="Filter anwenden" /></form>
<br/>
<?php
include_once 'includes/DBManager.php';
$dbm=new DBManager();
//Geschmack
if(isset ($_POST['Geschmack']) AND $_POST['Geschmack']=="1")
{
$sql= "SELECT `Name`, Beschreibung, Alkoholgehalt
FROM `Cocktail`
INNER JOIN Cocktail_has_Geschmacksrichtung
ON Cocktail.idCocktail = Cocktail_has_Geschmacksrichtung.Cocktail_idCocktai l
WHERE Geschmacksrichtung_idGeschmacksrichtung = 1";
$dbm->datenausgabeSimple($sql);
}
if(isset ($_POST['Geschmack']) AND $_POST['Geschmack']=="2")
{
$sql= "SELECT `Name`, Beschreibung, Alkoholgehalt
FROM `Cocktail`
INNER JOIN Cocktail_has_Geschmacksrichtung
ON Cocktail.idCocktail = Cocktail_has_Geschmacksrichtung.Cocktail_idCocktai l
WHERE Geschmacksrichtung_idGeschmacksrichtung = 2";
$dbm->datenausgabeSimple($sql);
}
if(isset ($_POST['Geschmack']) AND $_POST['Geschmack']=="3")
{
$sql= "SELECT `Name`, Beschreibung, Alkoholgehalt
FROM `Cocktail`
INNER JOIN Cocktail_has_Geschmacksrichtung
ON Cocktail.idCocktail = Cocktail_has_Geschmacksrichtung.Cocktail_idCocktai l
WHERE Geschmacksrichtung_idGeschmacksrichtung = 3";
$dbm->datenausgabeSimple($sql);
}
if(isset ($_POST['Geschmack']) AND $_POST['Geschmack']=="4")
{
$sql= "SELECT `Name`, Beschreibung, Alkoholgehalt
FROM `Cocktail`
INNER JOIN Cocktail_has_Geschmacksrichtung
ON Cocktail.idCocktail = Cocktail_has_Geschmacksrichtung.Cocktail_idCocktai l
WHERE Geschmacksrichtung_idGeschmacksrichtung = 4";
$dbm->datenausgabeSimple($sql);
}
if(isset ($_POST['Geschmack']) AND $_POST['Geschmack']=="5")
{
$sql= "SELECT `Name`, Beschreibung, Alkoholgehalt
FROM `Cocktail`
INNER JOIN Cocktail_has_Geschmacksrichtung
ON Cocktail.idCocktail = Cocktail_has_Geschmacksrichtung.Cocktail_idCocktai l
WHERE Geschmacksrichtung_idGeschmacksrichtung = 5";
$dbm->datenausgabeSimple($sql);
}
if(isset ($_POST['Geschmack']) AND $_POST['Geschmack']=="6")
{
$sql= "SELECT `Name`, Beschreibung, Alkoholgehalt
FROM `Cocktail`
INNER JOIN Cocktail_has_Geschmacksrichtung
ON Cocktail.idCocktail = Cocktail_has_Geschmacksrichtung.Cocktail_idCocktai l
WHERE Geschmacksrichtung_idGeschmacksrichtung = 6";
$dbm->datenausgabeSimple($sql);
}
if(isset ($_POST['Geschmack']) AND $_POST['Geschmack']=="7")
{
$sql= "SELECT `Name`, Beschreibung, Alkoholgehalt
FROM `Cocktail`
INNER JOIN Cocktail_has_Geschmacksrichtung
ON Cocktail.idCocktail = Cocktail_has_Geschmacksrichtung.Cocktail_idCocktai l
WHERE Geschmacksrichtung_idGeschmacksrichtung = 7";
$dbm->datenausgabeSimple($sql);
}
if(isset ($_POST['Geschmack']) AND $_POST['Geschmack']=="8")
{
$sql= "SELECT `Name`, Beschreibung, Alkoholgehalt
FROM `Cocktail`
INNER JOIN Cocktail_has_Geschmacksrichtung
ON Cocktail.idCocktail = Cocktail_has_Geschmacksrichtung.Cocktail_idCocktai l
WHERE Geschmacksrichtung_idGeschmacksrichtung = 8";
$dbm->datenausgabeSimple($sql);
}
if(isset ($_POST['Geschmack']) AND $_POST['Geschmack']=="9")
{
$sql= "SELECT `Name`, Beschreibung, Alkoholgehalt
FROM `Cocktail`
INNER JOIN Cocktail_has_Geschmacksrichtung
ON Cocktail.idCocktail = Cocktail_has_Geschmacksrichtung.Cocktail_idCocktai l
WHERE Geschmacksrichtung_idGeschmacksrichtung = 9";
$dbm->datenausgabeSimple($sql);
}
if(isset ($_POST['Geschmack']) AND $_POST['Geschmack']=="10")
{
$sql= "SELECT `Name`, Beschreibung, Alkoholgehalt
FROM `Cocktail`
INNER JOIN Cocktail_has_Geschmacksrichtung
ON Cocktail.idCocktail = Cocktail_has_Geschmacksrichtung.Cocktail_idCocktai l
WHERE Geschmacksrichtung_idGeschmacksrichtung = 10";
$dbm->datenausgabeSimple($sql);
}
if(isset ($_POST['Geschmack']) AND $_POST['Geschmack']=="11")
{
$sql= "SELECT `Name`, Beschreibung, Alkoholgehalt
FROM `Cocktail`
INNER JOIN Cocktail_has_Geschmacksrichtung
ON Cocktail.idCocktail = Cocktail_has_Geschmacksrichtung.Cocktail_idCocktai l
WHERE Geschmacksrichtung_idGeschmacksrichtung = 11";
$dbm->datenausgabeSimple($sql);
}
?>
<table>
<table border="1">
<caption> Cocktailrezepte </caption>
<tr>
<th> Bezeichnung </th>
<th> Schwierigkeitsgrad </th>
<th> Alkohol? </th>
</tr>
<tr>
<td> <a href="cocktailrezepte/bloodymary.php">Bloody Mary </a></td>
<td>✰ ✰ ✰ ✰</td>
<td> Ja! </td>
</tr>
<tr>
<td> <a href="cocktailrezepte/caipirinha.php">Caipirinha </a> </td>
<td> ✰ ✰</td>
<td> Ja! </td>
</tr>
<tr>
<td> <a href="cocktailrezepte/cinderella.php">Cinderella</a></td>
<td> ✰ ✰ </td>
<td> Nein! </td>
</tr>
<tr>
<td> <a href="cocktailrezepte/cosmopolitan.php">Cosmopolitan </a></td>
<td> ✰ ✰ ✰ ✰ ✰ </td>
<td> Ja! </td>
</tr>
<tr>
<td> <a href="cocktailrezepte/cubalibre.php">Cuba Libre </a></td>
<td> ✰ ✰ ✰</td>
<td> Ja! </td>
</tr>
<tr>
<td> <a href="cocktailrezepte/hurricane.php">Hurricane</a></td>
<td> ✰ ✰ ✰ ✰</td>
<td> Ja! </td>
</tr>
<tr>
<td> <a href="cocktailrezepte/ipanema.php">Ipanema </a></td>
<td> ✰ </td>
<td> Nein! </td>
</tr>
<tr>
<td> <a href="cocktailrezepte/longislandicetea.php">Long Island Icetea</a></td>
<td> ✰ ✰ ✰ ✰ </td>
<td> Ja! </td>
</tr>
<tr>
<td> <a href="cocktailrezepte/maitai.php">Mai-Tai </a></td>
<td> ✰ ✰ ✰</td>
<td> Ja! </td>
</tr>
<tr>
<td> <a href="cocktailrezepte/malibubeach.php">Malibu Beach</a></td>
<td> ✰</td>
<td> Ja! </td>
</tr>
<tr>
<td> <a href="cocktailrezepte/margarita.php">Margarita </a></td>
<td> ✰ ✰ ✰ ✰ ✰</td>
<td> Ja! </td>
</tr>
<tr>
<td> <a href="cocktailrezepte/mojito.php">Mojito </a></td>
<td> ✰ ✰ ✰ </td>
<td> Ja! </td>
</tr>
<tr>
<td> <a href="cocktailrezepte/moskito.php">Moskito</a></td>
<td> ✰ ✰ </td>
<td> Nein! </td>
</tr>
<tr>
<td> <a href="cocktailrezepte/pinacolada.php">Pina Colada </a></td>
<td> ✰ ✰ ✰</td>
<td> Ja! </td>
</tr>
<tr>
<td> <a href="cocktailrezepte/safersex.php">Safer Sex</a></td>
<td> ✰ ✰</td>
<td> Nein! </td>
</tr>
<tr>
<td> <a href="cocktailrezepte/sexonthebeach.php">Sex on the Beach </a></td>
<td> ✰ ✰ ✰</td>
<td> Ja! </td>
</tr>
<tr>
<td> <a href="cocktailrezepte/swimmingpool.php">Swimmingpool</a></td>
<td> ✰ ✰ ✰ ✰ ✰</td>
<td> Ja! </td>
</tr>
<tr>
<td> <a href="cocktailrezepte/tequilasunrise.php">Tequila Sunrise </a></td>
<td> ✰ ✰ ✰</td>
<td> Ja! </td>
</tr>
<tr>
<td> <a href="cocktailrezepte/virgincolada.php">Virgin Colada</a></td>
<td> ✰ </td>
<td> Nein! </td>
</tr>
<tr>
<td> <a href="cocktailrezepte/zombie.php">Zombie </a></td>
<td> ✰ ✰ ✰ ✰ ✰ </td>
<td> Ja! </td>
</tr>
</table>
</section>
<?php include("includes/footer.php");?>
Vllt weiß ja jemand, wie ich das ändern kann!
ich habe mit HTML eine Tabelle erstellt, die durch Links auf verschiedene Webseiten verweist. Durch ein Drop-Down-Menü soll diese Tabelle nun gefiltert werden und nur noch die Zeilen angezeigt werden, die zu der Auswahl des Formulars passen. Zur Zeit bleibt die Tabelle noch auf der Seite und über der Tabelle kommt eine weitere Tabelle mit den Ausgaben.
Hier ist mein Quelltext:
<?php include("includes/header.php");?>
<body>
<h1>Die 20 besten Cocktailrezepte</h1>
<article>
<header>
<p>Nun geht's los: Verschaff dir einen Überblick über unsere fantastische und einzigartige Cocktailauswahl! Ein Klick auf den Cocktail bringt dich deinem Partyabend einen Schritt näher.</p>
</header>
<?php include("includes/nav.php");?>
<section>
<img src="bilder/bar.jpg" width="350" height="180" alt="Bildbar">
<img src="bilder/haengematte.jpg" width="350" height="180" alt="Bildhängematte">
<img src="bilder/kiwi.jpg" width="350" height="180" alt="Bildkiwi">
<h3>Cocktailtabelle</h3>
<form action="" method="post" name="register">
Wähle deinen Geschmack aus und finde heraus, welche Cocktails für dich passen! Anschließend kannst du in der Tabelle auf deinen Cocktail klicken und das Rezept öffnen!<br/><br/>
Geschmacksrichtung:
<select name="Geschmack" size="1">
<option value="0"> Wähle deinen Geschmack! </option>
<option value="1"> scharf</option>
<option value="2"> aromatisch </option>
<option value="3"> würzig </option>
<option value="4"> süß </option>
<option value="5"> sauer </option>
<option value="6"> erfrischend</option>
<option value="7"> sahnig </option>
<option value="8"> fruchtig </option>
<option value="9"> herb </option>
<option value="10"> prickelnd </option>
<option value="11"> cremig </option>
</select>
<input type="submit" value="Filter anwenden" /></form>
<br/>
<?php
include_once 'includes/DBManager.php';
$dbm=new DBManager();
//Geschmack
if(isset ($_POST['Geschmack']) AND $_POST['Geschmack']=="1")
{
$sql= "SELECT `Name`, Beschreibung, Alkoholgehalt
FROM `Cocktail`
INNER JOIN Cocktail_has_Geschmacksrichtung
ON Cocktail.idCocktail = Cocktail_has_Geschmacksrichtung.Cocktail_idCocktai l
WHERE Geschmacksrichtung_idGeschmacksrichtung = 1";
$dbm->datenausgabeSimple($sql);
}
if(isset ($_POST['Geschmack']) AND $_POST['Geschmack']=="2")
{
$sql= "SELECT `Name`, Beschreibung, Alkoholgehalt
FROM `Cocktail`
INNER JOIN Cocktail_has_Geschmacksrichtung
ON Cocktail.idCocktail = Cocktail_has_Geschmacksrichtung.Cocktail_idCocktai l
WHERE Geschmacksrichtung_idGeschmacksrichtung = 2";
$dbm->datenausgabeSimple($sql);
}
if(isset ($_POST['Geschmack']) AND $_POST['Geschmack']=="3")
{
$sql= "SELECT `Name`, Beschreibung, Alkoholgehalt
FROM `Cocktail`
INNER JOIN Cocktail_has_Geschmacksrichtung
ON Cocktail.idCocktail = Cocktail_has_Geschmacksrichtung.Cocktail_idCocktai l
WHERE Geschmacksrichtung_idGeschmacksrichtung = 3";
$dbm->datenausgabeSimple($sql);
}
if(isset ($_POST['Geschmack']) AND $_POST['Geschmack']=="4")
{
$sql= "SELECT `Name`, Beschreibung, Alkoholgehalt
FROM `Cocktail`
INNER JOIN Cocktail_has_Geschmacksrichtung
ON Cocktail.idCocktail = Cocktail_has_Geschmacksrichtung.Cocktail_idCocktai l
WHERE Geschmacksrichtung_idGeschmacksrichtung = 4";
$dbm->datenausgabeSimple($sql);
}
if(isset ($_POST['Geschmack']) AND $_POST['Geschmack']=="5")
{
$sql= "SELECT `Name`, Beschreibung, Alkoholgehalt
FROM `Cocktail`
INNER JOIN Cocktail_has_Geschmacksrichtung
ON Cocktail.idCocktail = Cocktail_has_Geschmacksrichtung.Cocktail_idCocktai l
WHERE Geschmacksrichtung_idGeschmacksrichtung = 5";
$dbm->datenausgabeSimple($sql);
}
if(isset ($_POST['Geschmack']) AND $_POST['Geschmack']=="6")
{
$sql= "SELECT `Name`, Beschreibung, Alkoholgehalt
FROM `Cocktail`
INNER JOIN Cocktail_has_Geschmacksrichtung
ON Cocktail.idCocktail = Cocktail_has_Geschmacksrichtung.Cocktail_idCocktai l
WHERE Geschmacksrichtung_idGeschmacksrichtung = 6";
$dbm->datenausgabeSimple($sql);
}
if(isset ($_POST['Geschmack']) AND $_POST['Geschmack']=="7")
{
$sql= "SELECT `Name`, Beschreibung, Alkoholgehalt
FROM `Cocktail`
INNER JOIN Cocktail_has_Geschmacksrichtung
ON Cocktail.idCocktail = Cocktail_has_Geschmacksrichtung.Cocktail_idCocktai l
WHERE Geschmacksrichtung_idGeschmacksrichtung = 7";
$dbm->datenausgabeSimple($sql);
}
if(isset ($_POST['Geschmack']) AND $_POST['Geschmack']=="8")
{
$sql= "SELECT `Name`, Beschreibung, Alkoholgehalt
FROM `Cocktail`
INNER JOIN Cocktail_has_Geschmacksrichtung
ON Cocktail.idCocktail = Cocktail_has_Geschmacksrichtung.Cocktail_idCocktai l
WHERE Geschmacksrichtung_idGeschmacksrichtung = 8";
$dbm->datenausgabeSimple($sql);
}
if(isset ($_POST['Geschmack']) AND $_POST['Geschmack']=="9")
{
$sql= "SELECT `Name`, Beschreibung, Alkoholgehalt
FROM `Cocktail`
INNER JOIN Cocktail_has_Geschmacksrichtung
ON Cocktail.idCocktail = Cocktail_has_Geschmacksrichtung.Cocktail_idCocktai l
WHERE Geschmacksrichtung_idGeschmacksrichtung = 9";
$dbm->datenausgabeSimple($sql);
}
if(isset ($_POST['Geschmack']) AND $_POST['Geschmack']=="10")
{
$sql= "SELECT `Name`, Beschreibung, Alkoholgehalt
FROM `Cocktail`
INNER JOIN Cocktail_has_Geschmacksrichtung
ON Cocktail.idCocktail = Cocktail_has_Geschmacksrichtung.Cocktail_idCocktai l
WHERE Geschmacksrichtung_idGeschmacksrichtung = 10";
$dbm->datenausgabeSimple($sql);
}
if(isset ($_POST['Geschmack']) AND $_POST['Geschmack']=="11")
{
$sql= "SELECT `Name`, Beschreibung, Alkoholgehalt
FROM `Cocktail`
INNER JOIN Cocktail_has_Geschmacksrichtung
ON Cocktail.idCocktail = Cocktail_has_Geschmacksrichtung.Cocktail_idCocktai l
WHERE Geschmacksrichtung_idGeschmacksrichtung = 11";
$dbm->datenausgabeSimple($sql);
}
?>
<table>
<table border="1">
<caption> Cocktailrezepte </caption>
<tr>
<th> Bezeichnung </th>
<th> Schwierigkeitsgrad </th>
<th> Alkohol? </th>
</tr>
<tr>
<td> <a href="cocktailrezepte/bloodymary.php">Bloody Mary </a></td>
<td>✰ ✰ ✰ ✰</td>
<td> Ja! </td>
</tr>
<tr>
<td> <a href="cocktailrezepte/caipirinha.php">Caipirinha </a> </td>
<td> ✰ ✰</td>
<td> Ja! </td>
</tr>
<tr>
<td> <a href="cocktailrezepte/cinderella.php">Cinderella</a></td>
<td> ✰ ✰ </td>
<td> Nein! </td>
</tr>
<tr>
<td> <a href="cocktailrezepte/cosmopolitan.php">Cosmopolitan </a></td>
<td> ✰ ✰ ✰ ✰ ✰ </td>
<td> Ja! </td>
</tr>
<tr>
<td> <a href="cocktailrezepte/cubalibre.php">Cuba Libre </a></td>
<td> ✰ ✰ ✰</td>
<td> Ja! </td>
</tr>
<tr>
<td> <a href="cocktailrezepte/hurricane.php">Hurricane</a></td>
<td> ✰ ✰ ✰ ✰</td>
<td> Ja! </td>
</tr>
<tr>
<td> <a href="cocktailrezepte/ipanema.php">Ipanema </a></td>
<td> ✰ </td>
<td> Nein! </td>
</tr>
<tr>
<td> <a href="cocktailrezepte/longislandicetea.php">Long Island Icetea</a></td>
<td> ✰ ✰ ✰ ✰ </td>
<td> Ja! </td>
</tr>
<tr>
<td> <a href="cocktailrezepte/maitai.php">Mai-Tai </a></td>
<td> ✰ ✰ ✰</td>
<td> Ja! </td>
</tr>
<tr>
<td> <a href="cocktailrezepte/malibubeach.php">Malibu Beach</a></td>
<td> ✰</td>
<td> Ja! </td>
</tr>
<tr>
<td> <a href="cocktailrezepte/margarita.php">Margarita </a></td>
<td> ✰ ✰ ✰ ✰ ✰</td>
<td> Ja! </td>
</tr>
<tr>
<td> <a href="cocktailrezepte/mojito.php">Mojito </a></td>
<td> ✰ ✰ ✰ </td>
<td> Ja! </td>
</tr>
<tr>
<td> <a href="cocktailrezepte/moskito.php">Moskito</a></td>
<td> ✰ ✰ </td>
<td> Nein! </td>
</tr>
<tr>
<td> <a href="cocktailrezepte/pinacolada.php">Pina Colada </a></td>
<td> ✰ ✰ ✰</td>
<td> Ja! </td>
</tr>
<tr>
<td> <a href="cocktailrezepte/safersex.php">Safer Sex</a></td>
<td> ✰ ✰</td>
<td> Nein! </td>
</tr>
<tr>
<td> <a href="cocktailrezepte/sexonthebeach.php">Sex on the Beach </a></td>
<td> ✰ ✰ ✰</td>
<td> Ja! </td>
</tr>
<tr>
<td> <a href="cocktailrezepte/swimmingpool.php">Swimmingpool</a></td>
<td> ✰ ✰ ✰ ✰ ✰</td>
<td> Ja! </td>
</tr>
<tr>
<td> <a href="cocktailrezepte/tequilasunrise.php">Tequila Sunrise </a></td>
<td> ✰ ✰ ✰</td>
<td> Ja! </td>
</tr>
<tr>
<td> <a href="cocktailrezepte/virgincolada.php">Virgin Colada</a></td>
<td> ✰ </td>
<td> Nein! </td>
</tr>
<tr>
<td> <a href="cocktailrezepte/zombie.php">Zombie </a></td>
<td> ✰ ✰ ✰ ✰ ✰ </td>
<td> Ja! </td>
</tr>
</table>
</section>
<?php include("includes/footer.php");?>
Vllt weiß ja jemand, wie ich das ändern kann!

Kommentar