1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
class Form extends Stack
{ private $form, $formValid, $check ;
private $action, $method, $id, $name ;
private $tab_field = array() ;
/**
* From constructor
*
*/
function __construct($action = NULL, $method = NULL, $id = NULL, $name = NULL) {
// $this->initForm($form);
$this->action = $action ;
$this->method = $method ;
$this->name = $name ;
$this->id = $id ;
// var_dump($action,$method,$îd,$name) ;
$this->validate() ;
}
function __destruct()
{}
function validate()
{ $this->action = ($this->action != NULL) ? $this->action : '$_SERVER[\'PHP_SELF\']';
$this->method = ($this->method != NULL) ? $this->method : 'POST';
//
// name OR id must be specified
// ============================
if ((isset($this->id) && isset($this->name))) {
user_error("NAME or ID Should be specified" , E_USER_ERROR);
} elseif ( ! isset($this->id)) {
$this->id = $this->name;
} else {
$this->name = $this->id;
}
var_dump($this->action,$this->method,$this->îd,$this->name) ;
}
private function initForm($form)
{ $this->form = $form ;
Stack::emptyStack() ;
}
/**
* Form Start
*
*/
function start()
{
61==> echo '<form action="'.$this->action.'" method="'.$this->method.'" name="'.$this->name.'" id="'.$this->id.'">' ;
' } |
Partager