Tutorials Infos - Anleitungen - Hilfe - Dreamcodes
 

Dropdown

Funktion zum generieren eines DropDown Auswahlfeldes für beliebig viele Jahreszahlen
 
Script:
<?php
function getDropDownJahreszahlen($anzahl = 10, $parameter = "")
{
   
$jahr = date("Y");
   
$endjahr = $jahr - $anzahl;
     
   
$option = "<option value=\"0\"";

   if(
$parameter == "0" || $parameter == "")
   {
      
$option .= " selected";
   }

   
$option .= ">Jahr</option>";
         
   print
$option;
         
   for(;
$jahr > $endjahr; $jahr--)
   {
     
$option =  "<option value=\"".$jahr."\"";
       
     if(
$parameter == $jahr)
     {
       
$option .= " selected";
     }
             
     
$option .= ">".$jahr."</option>";
             
     print
$option;
   }
}   
?>

 
ID: 1501
eingestellt am: 29.10.2007
Autor: Michael Langhoff
Status zum lesen: Gast
gelesen: 6188
Webseite: www.dreamcodes.com
[Drucken]