cross: Wieso "Undefined variable vTagOptions"?

Hallo Forum,

als ziemlicher Anfänger verstehe ich die o.a. Notice von PHP nicht:

  
 for($i=1; $i<32; $i++) {  
  $vTagOptions .= "  <option>".$i."</option>\n";  
 }  
 for($i=1; $i<32; $i++) {  
  $bTagOptions .= $i == $tag ? "  <option selected=\"selected\">".$i."</option>\n" : "  <option>".$i."</option>\n";  
 }  
 for($i=1; $i<13; $i++) {  
  $monOptions .= $i == $mon ? "  <option selected=\"selected\">".$i."</option>\n" : "  <option>".$i."</option>\n";  
 }  
 for($i=2007; $i<2011; $i++) {  
  $jahrOptions .= $i == $jahr ? "  <option selected=\"selected\">".$i."</option>\n" : "  <option>".$i."</option>\n";  
 }  

Die Variablen $bTagOptions, $monOptions und $jahrOptions werden ebenfalls angemeckert.

Für mich sind die Variablen keineswegs undefiniert, sondern es steht doch was drin, nämlich jeweils ein Option-Tag.

Wäre nett, wenn mir das mal jemand verständlich erklären könnte. Google gibt dazu zig 1000 Seiten raus mit Beispielen für undefinierte Variablen, jedoch verstehe ich nicht, WAS genau ich falsch mache.

Vielen Dank im voraus
Gruß
cross

  1. Hi,

    $vTagOptions .= "  <option>".$i."</option>\n";

    Du hängst hier etwas an - beim ersten Schleifendurchlauf existiert aber die Variable noch nicht.

    cu,
    Andreas

    --
    Warum nennt sich Andreas hier MudGuard?
    O o ostern ...
    Fachfragen unaufgefordert per E-Mail halte ich für unverschämt und werde entsprechende E-Mails nicht beantworten. Für Fachfragen ist das Forum da.
    1. Du hängst hier etwas an - beim ersten Schleifendurchlauf existiert aber die Variable noch nicht.

      *klatschvornKopf*

      ABSOLUT YESssss! Natürlich! :))
      Vielen Dank! - damit habe auch ich es verstanden!

      mfG
      Cross