<?phpclass getpost{public $get = array();public $post = array();function getpost(){if(isset($_GET)){$this->get();}if(isset($_POST)){$this->post();}}function get(){$dizi = array_keys($_GET);if(count($dizi)!=0){for($n=0;$n<count($dizi);$n++){$this->get[$dizi[$n]] = $_GET[$dizi[$n]];}}else{$this->get = NULL;}}function post(){$dizi = array_keys($_POST);if(count($dizi)!=0){for($n=0;$n<count($dizi);$n++){$this->post[$dizi[$n]] = $_POST[$dizi[$n]];}}else{$this->post = NULL;}}}$a = new getpost();if($a->get){echo "<pre>";print_r($a->post);echo "<br>";print_r($a->get);}else{?> name="form1" method="post" action="?get=1"type="text" name="post"type="text" name="post2"type="text" name="post3"type="text" name="post4"type="text" name="post5"type="text" name="post6"type="submit" name="gonder" value="GÖNDER"<?php } ?>
Çıktısı
Array([post] => yazı1[post2] => yazı2[post3] => yazı3[post4] => yazı4[post5] => yazı5[post6] => yazı6[gonder] => GÖNDER)Array([get] => 1)