| 
 | 
PHP ile Tarihi Seçim Kutularında Göstermek - PHP Webmaster bilgi bankası, knowledge base Webmaster Araçları
| AnaSayfa > PHP  > PHP ile Tarihi Seçim Kutularında Göstermek |  | 
 |  | Kategori | : PHP |  | Gönderen | : Admin |  | Tarih | : 2009-02-13 |  | Puan | : 10     | Katılımcı : 1 |  | Okunma | : 4767 |  |   |   |  |   |  
 |    |   <?  
class dateForm {     
  var $day=31;     
  var $month=12;     
  var $year_s=2005;     
  var $year_f=2015;     
  var $dayname="gun";     
  var $monthname="ay";     
  var $yearname="yil";     
  var $style;     
  var $selectedday,$selectedmonth,$selectedyear=0;     
  var $display="";       
     
  function setDateForm($sv=0) {       
    if ($sv<>0)           
      $this->setSelectedValues($sv);       
      $this->displayForm(1,$this->day,$this->dayname,$this->style,$this->selectedday);       
      $this->displayForm(1,$this->month,$this->monthname,$this->style,$this->selectedmonth);       
      $this->displayForm($this->year_s,$this->year_f,$this->yearname,$this->style,$this->selectedyear);       
        //echo $this->display;     
    }       
    function setSelectedValues($sv) {        
      $date_array=split("-",$sv);        
      $this->selectedyear=$date_array[0];        
      $this->selectedmonth=$date_array[1];        
      $this->selectedday=$date_array[2];     
    }       
    function dateStyle($style) {       
      $this->style=$style;     
    }    
    // function       
    function setFormnames($dayname,$monthname,$yearname) {       
      $this->dayname=$dayname;       
      $this->monthname=$monthname;       
      $this->yearname=$yearname;     
    }       
    function setDateValues($day,$month,$year_s,$year_f) {       
      $this->day=$day;       
      $this->month=$month;       
      $this->year_s=$year_s;       
      $this->year_f=$year_f;     
    }    
    // function       
    function displayForm($str,$lmt,$nm,$st,$selectedvalue=0) {       
      $this->display.= "n";       
      $this->display.= "---";       
      for ($i=$str;$i<=$lmt;$i++) {         
        $addition="";         
        if ($i==$selectedvalue)           
          $addition="selected";         
          $this->display.= "$in";       
        }       
        $this->display.= "  ";     
      }   
    }    
    // class   
 
//KULLANIMI :   
$trh=new dateForm();   
$trh->style="textnml"; // Stil Vermek İçin Kullanılır   
$trh->setDateForm(date("Y-m-d")); // Seçili Halde Gelecek Tarih   
$trh1=$trh->display;   
echo $trh1;   
 
// İkinci Bir Form Lazımsa   
$trh->display="";   
$trh->setFormnames("gun2","ay2","yil2"); // Form Elemanlarına İsim Verilir   
$trh->setDateForm("");   
$trh2=$trh->display;   
echo $trh2;   
?> 
 
  |   
| Yorumlar |  | Henüz Kimse Yorum Yapmamış, ilk yorumu siz ekleyin! |  | Yorum Ekleme Aparatı |  Yorum Eklemek için lütfen sol menuden giris yapınız..  |  | Toplam 0 yorum listelendi.  |  
   |