Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

KomboBox im Formular mit Daten aus Tabelle füllen

Empfohlene Antworten

Veröffentlicht

Hallo!

Ich habe eine Kombo Box in einem Formula

<select name="kundenname" size="1">

<option>kunde1</option>

<option>kunde2</option>

</select>

Wie schaffe ich es nun mit Hilfe von PHP, diese KomboBox dynamisch mit Werten aus der Tabelle "Kunden" zu füllen?

Klar ich brauche ein SQL Statement, aber wie bringt man die Ergebnisse dann in die BOx????

Danke!

Das ist ganz einfach! Du baust die Combobox bis zu der Stelle, an der die Options kommen. Hier liest Du erstmal alle Datensätze aus der DB aus. Dann setzt du eine PHP-Schleife, die jeden Datensatzwert einzeln in Variablen schreibt und danach in der Option ausgibt!

Also etwa so:


<select name="Name">
<?php
$sql = "SELECT Wert FROM Tabelle";
$erg = mysql_query($sql,$connection)
while(list($wert) = mysql_fetch_row($erg))
{
echo "<option>$wert</option>\n";
}
?>
</select>
[/PHP]

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.