Hallo Leute,
da ich mir gerade PHP beibringen möchte, teste ich es einfach an der ausgabe unseres gameservers
Mein Script als erstes, um das es sich derzeit handelt:
Ich binde dieses über das CMS Addon in WBB ein. Das Problem ist das er beim ersten aufrufen der seite einen fehler unter dem Dropdown hat, da er keine werte für "auswahl" besitzt.
Wie sage ich ihm nur das er wenn dort nichts ausgewählt ist einfach stehen soll: Keine Auswahl getroffen?
Danke im Vorraus
da ich mir gerade PHP beibringen möchte, teste ich es einfach an der ausgabe unseres gameservers
Mein Script als erstes, um das es sich derzeit handelt:
PHP-Code:
<?php
echo "<html>";
echo "<label>Suche dir dein Autohaus aus:</label>";
echo "<form method='POST'>";
echo "<select name='auswahl' size='0'>";
echo "<option value=''>wählen</option>";
echo "<option value='Wang Cars SF' selected>Wang Cars SF</option>";
echo "<option value='Wang LV West'>Wang LV West</option>";
echo "<option value='Wang LV Sued'>Wang LV Sued</option>";
echo "<option value='Hartzvier LS'>Hartzvier LS</option>";
echo "<option value='Boot Shop LS'>Boot Shop LS</option>";
echo "<option value='Ottos Biker Shop SF'>Ottos Biker Shop SF</option>";
echo "<option value='Roller Shop Flint Country'>Roller Shop Flint Country</option>";
echo "</select>";
echo "<input type='submit' value='Senden'>";
echo "</form>";
echo "</html>";
$db_link = mysqli_connect (
MYSQL_HOST,
MYSQL_BENUTZER,
MYSQL_KENNWORT,
MYSQL_DATENBANK
);
$sql_cars = "SELECT t2.carname as carname ,t2.vpreis as preis, t1.shopstatus as shopstatus,t1.model as model,t1.car_id as car_id,t1.Autohaus as Autohaus FROM cars as t1 inner join carinfo as t2 on t2.CID=t1.model";
$cars = mysqli_query( $db_link, $sql_cars);
echo '<table style="border-width:1px">';
echo '<tr><td>CAR ID</td><td>MODEL ID</td><td>Preis</td><td>Autoname</td></tr>';
while ($variable = mysqli_fetch_array( $cars, MYSQL_ASSOC))
{
if ($variable['Autohaus'] === $_POST['auswahl']) {
echo "<tr>";
echo "<th rowspan='2'><img src='http://weedarr.wdfiles.com/local--files/veh/". $variable['model'] . ".png' /></th>";
echo "<th colspan='2'>". $variable['carname'] ."</th>";
echo "</tr>";
echo "<tr>";
echo "<td>Preis:". $variable['preis'] . "$</td>";
echo "<td>ID:". $variable['car_id'] . "</td>";
echo "</td>";
echo "</tr>";
}
}
echo "</table>";
?>
Wie sage ich ihm nur das er wenn dort nichts ausgewählt ist einfach stehen soll: Keine Auswahl getroffen?
Danke im Vorraus
Kommentar