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.

Variablenübergabe von SelectBox zu SQL-Abfrage

Empfohlene Antworten

Veröffentlicht

Hallöle,

ich würde gerne wissen wie es klappt, dass ich die Werte aus meiner SelectBox an meine Sql-Abfrage übergebe. Momentan werden immer die Werte genommen, mit denen die Variablen vorbelegt sind.

$now=getdate();

$day2=$now['mday'];

$MONTH2=$now['month'];

$year2=$now['year'];

$activeId=3;

$sql = " SELECT YEAR(datetime)AS year,MONTH(datetime) AS month";

usw.

.

.

<form action="test2.php" method="post">

<select name="MONTH2"onchange="this.form.submit()">

<option value="02" <? if ($MONTH2 == "01") echo "selected";?>>Januar

<option value="02" <? if ($MONTH2 == "02") echo "selected";?>>Februar

<option value="03" <? if ($MONTH2== "03") echo "selected";?>>März

</select>

</form>

Danke:D

wellenreiter

Wenn Du programmierst, ist es wichtig, zu debuggen. Gib mal vor dener Form den Inhalt von $now['month'] aus etc und Du siehst was ich meine.

02 wäre dann February, womit der Vergleich in Deiner Selectbox natürlich fehlschlägt.

Schau Dir mal die date() Funktion von PHP genauer an und lies Dir die Benutzerkommentare genau durch, es gibt meistens jemanden der das gleiche Problem schon vor Dir hatte.

http://www.php.net/manual/de/function.date.php

<select name="MONTH2"onchange="this.form.submit()">

Da fehlt noch ein Leerzeichen.

$MONTH2=$now['month'];

das heisst nicht month sondern nur mon

$MONTH2=$now['mon'];

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.