Basit HTML Form Oluşturma Sınıfı

<?PHP
class formyap {
	function yeniform( $method, $action ) {
		$metin = "<form method=\"".$method."\" action=\"".$action."\">";
		return($metin);
	}
	function formubitir() {
		$metin =  "</form>";
		return($metin);
	}
	function metin( $ad ) {
		$metin = "<input type=\"metin\" ad=\"".$ad."\">";
		return($metin);
	}
	function pass( $ad ) {
		$metin = "<input type=\"password\" ad=\"".$ad."\">";
		return($metin);
	}
	function radio( $ad, $bilgi ) {
		$metin=null;
		foreach($bilgi as $deger) {
			$metin.=$deger." <input type=\"radio\" ad=\"".$ad."\" deger=\"". $deger ."\"></input>";
		}
		return($metin);
	}	 
	function checkbox( $bilgi ) {
		$metin=null;
		foreach( $bilgi as $anahtar=>$deger) {
			$metin.=$deger." <input type=\"checkbox\" ad=\"".$anahtar."\" deger=\"". $deger ."\"></input>";
		}
		return($metin);
	}
	function select( $ad, $bilgi, $boyut ) {
		$metin = "<SELECT NAME=\"".$ad."\" size=".$boyut.">";
		foreach( $bilgi as $deger ) {
			$metin.="<OPTION>".$deger;
		}
		$metin = $metin."</SELECT>";
		return($metin);
	}
	function kombo( $ad, $bilgi ) {
		$metin = "<SELECT NAME=\"".$ad."\">";
		foreach( $bilgi as $deger ) {
			$metin.="<OPTION>".$deger;
		}
		$metin = $metin."</SELECT>";
		return($metin);
	}
	function metinarea( $ad, $satir, $sutun ) {
		$metin = "<TEXTAREA NAME=\"".$ad."\" ROWS=".$satir." COLS=".$sutun."></TEXTAREA>";
		return($metin);
	}
	function submit( $ad, $deger ) {
		$metin = "<INPUT TYPE=submit NAME=\"".$ad."\"VALUE=\"".$deger."\"></INPUT>";
		return($metin);
	}
	function fclear( $ad ) {
		$metin = "<INPUT TYPE=reset VALUE=\"".$ad."\"></INPUT>";
		return($metin);
	}
}
$frm = new formyap();
echo $frm->yeniform( "POST", "index.php" );
echo $frm->metin("testing");
echo $frm->pass("testing");
echo $frm->radio( "test", array("v1", "v2", "v3", "v4"));
echo $frm->checkbox(array("test1"=>"v1", "test2"=>"v2", "test3"=>"v3", "test4"=>"v4"));
echo $frm->select( "test", array("v1", "v2", "v3", "v4"), 4);
echo $frm->kombo( "test", array("v1", "v2", "v3", "v4"));
echo $frm->metinarea( "testing", 6, 60 );
echo $frm->submit("submit", "Gönder");
echo $frm->fclear( "Sıfırla" );
echo $frm->formubitir();
?>

Çıktı

<form method="POST" action="index.php">
   <input type="text" name="testing"><input type="password" name="testing">v1 <input type="radio" name="test" value="v1"></input>v2 <input type="radio" name="test" value="v2"></input>v3 <input type="radio" name="test" value="v3"></input>v4 <input type="radio" name="test" value="v4"></input>v1 <input type="checkbox" name="test1" value="v1"></input>v2 <input type="checkbox" name="test2" value="v2"></input>v3 <input type="checkbox" name="test3" value="v3"></input>v4 <input type="checkbox" name="test4" value="v4"></input>
   <SELECT NAME="test" size=4>
      <OPTION>v1
      <OPTION>v2
      <OPTION>v3
      <OPTION>v4
   </SELECT>
   <SELECT NAME="test">
      <OPTION>v1
      <OPTION>v2
      <OPTION>v3
      <OPTION>v4
   </SELECT>
   <TEXTAREA NAME="testing" ROWS=6 COLS=60></TEXTAREA>
   <INPUT TYPE=submit NAME="submiter"VALUE="Submit Me!"></INPUT><INPUT TYPE=reset VALUE="Reset Form"></INPUT>
</form>

 

Http Post İsteklerine Erişim Sınıfı

<?php    
header('Content-Type: text/html; charset=utf-8');
class Yayin {
	private static $ornek;
	public static function ornekAl() {
			if (self::$ornek == null) {
					self::$ornek = new Yayin();
			}
			return self::$ornek;
	}
	protected function __construct(){
			foreach($_POST as $key => $value ){
					$this->$key = $value;
			}
	}
	public function __get($isim){
			if (!isSet($this->$isim)){
					$this->$isim= '';
			}
	}
}
$yayin = Yayin::ornekAl();
$deger = $yayin->deger;
$artis = $yayin->artis;
if ($artis == null) {
	$artis = 1;
}
$deger += $artis;
?>
<html>
    <body>
        <form method="POST">
            Arttırılacak Değer: <input type="text" name="deger" value="<?php echo $deger;?>"/>
            <br/>Artış: <input type="text" name="artis" value="<?php echo $artis;?>"/>
            <br/><input type="submit" value="Arttır"/>
        </form>
    </body>
</html>

Çıktısı öne çıkan görseldeki gibidir.

Form Giriş ve Denetim Sınıfı

<?php
Class girisKontrol{
	var $form=null;
	function __construct(){
		$this->form.='<form method="post" action="">';
	}
	function metinKontrol($name,$value,$tut){
		$this->form.='<input type="text" name="'.$name.'" value="'.$value.'" placeholder="'.$tut.'">';
	}
	function sifreKontrol($name,$value,$tut){
		$this->form.='<input type="password" name="'.$name.'" value="'.$value.'" placeholder="'.$tut.'">';
	}
	function metinKutusuKontrol($name,$value,$tut){
		$this->form.='<textarea name="'.$name.'" placeholder="'.$tut.'">'.$value.'</textarea>';
	}
	function onayKutusuKontrol($name,$value){
		$this->form.='<input type="checkbox" name="'.$name.'" value="'.$value.'">';
	}
	function radyoKontrol($name,$value){
		$this->form.='<input type="radio" name="'.$name.'" value="'.$value.'">';
	}
	function butonKontrol($type,$name,$value,$tut){
		$this->form.='<input type="'.$type.'" name="'.$name.'" value="'.$value.'" placeholder="'.$tut.'">';
	}
	function secenekEkle($name){
		$this->form.='<option value="">'.$name.'</option>';
	}
	function listeKontrol($value){
		$this->form.='<select name="">';
		foreach($value as $v){
			$this->form.=$this->secenekEkle($v);
		}	
		$this->form.='</select>';
	}
	function yazdir(){
		$this->form.='</form>';
		return $this->form;
	}
}
$gK = new girisKontrol;
$gK->metinKontrol("abc","","Bir metin giriniz");
$gK->sifreKontrol("abc","","Şifre");
$gK->metinKutusuKontrol("abc","","Birşeyler Yazınız");
$gK->listeKontrol(["Ankara","Aksaray"]);
$gK->onayKutusuKontrol("abcd","");
$gK->radyoKontrol("abc","");
$gK->butonKontrol("button","gonder","Tıkla","");
echo $gK->yazdir();

Çıktısı

<form method="post" action="">
   <input type="text" name="abc" value="" placeholder="Bir metin giriniz"><input type="password" name="abc" value="" placeholder="Şifre">
   <textarea name="abc" placeholder="Birşeyler Yazınız"></textarea>
   <select name="">
      <option value="">Ankara</option>
      <option value="">Aksaray</option>
   </select>
   <input type="checkbox" name="abcd" value=""><input type="radio" name="abc" value=""><input type="button" name="gonder" value="Tıkla" placeholder="">
</form>

 

Form Üzerinden Doğum Günü İşlemleri

<?php
function zaman($deger){
	$z=array();
	if(version_compare(phpversion(),'5.2.0','>=')){
		$zaman = new DateTime($deger);
		$zaman->setTimezone(new DateTimeZone('Europe/Istanbul'));
		$z["yil"]=$zaman->format('Y');
		$z["ay"]=$zaman->format('m');
		$z["gun"]=$zaman->format('d');
		$z["tam"]=$zaman->format('Y\-m\-d');
		$z["damga"]=$zaman->getTimestamp();
		
	}else{
		$sifirla = date_default_timezone_get();
		date_default_timezone_set('Europe/Istanbul');
		$damga=strtotime($deger);
		date_default_timezone_set($sifirla);
		$z["yil"]=date('Y',$damga);
		$z["ay"]=date('m',$damga);
		$z["gun"]=date('d',$damga);
		$z["tam"]=date('Y\-m\-d',$damga);
		$z["damga"]=$damga;
		
	}
	return $z;
}
function dogumTarihi($kacyilonce,$ad=null,$kimlik=null,$sinif=null){
	$once=(date("Y",(time()))-$kacyilonce)."-".date("m-d",(time()));
	$simdi=date("Y-m-d",time());
	return '<input name="'.$ad.'" class="'.$sinif.'" id="'.$kimlik.'"'.
		' max="'.$simdi.'" min="'.$once.'" type="date" />';
}
?>
<form action="" method="post">
<?php echo dogumTarihi(90,"ddlBirthYear","ddlDogumYil"); ?>
<input type="submit" value="Gönder"/>
</form>
<?php

if(isset($_POST["ddlBirthYear"])){
	$zaman=zaman($_POST["ddlBirthYear"])
	print_r($zaman);
	//echo $zaman["tam"];
}
?>

Çıktısı

Array ( [yil] => 2015 [ay] => 03 [gun] => 12 [tam] => 2015-03-12 [damga] => 1426114800 )