diff --git a/html/HTML.php b/html/HTML.php index dd32a88..810ff6f 100644 --- a/html/HTML.php +++ b/html/HTML.php @@ -24,3 +24,5 @@ if (!@include_once(__DIR__."/HTMLA.php")) throw new Exception("Compat: HTMLA.php is missing. Failed to include HTMLA.php"); if (!@include_once(__DIR__."/HTMLImg.php")) throw new Exception("Compat: HTMLImg.php is missing. Failed to include HTMLImg.php"); if (!@include_once(__DIR__."/HTMLDiv.php")) throw new Exception("Compat: HTMLDiv.php is missing. Failed to include HTMLDiv.php"); +if (!@include_once(__DIR__."/HTMLSelect.php")) throw new Exception("Compat: HTMLSelect.php is missing. Failed to include HTMLSelect.php"); +if (!@include_once(__DIR__."/HTMLOption.php")) throw new Exception("Compat: HTMLOption.php is missing. Failed to include HTMLOption.php"); diff --git a/html/HTMLForm.php b/html/HTMLForm.php index 1233296..cfb28f4 100644 --- a/html/HTMLForm.php +++ b/html/HTMLForm.php @@ -26,6 +26,8 @@ class HTMLForm public string $method; /** @var array $inputs **/ public array $inputs; + /** @var array $selects **/ + public array $selects; /** @var array $buttons **/ public array $buttons; @@ -34,6 +36,7 @@ function __construct(string $action, string $method) $this->action = $action; $this->method = $method; $this->inputs = array(); + $this->selects = array(); $this->buttons = array(); } @@ -42,6 +45,11 @@ public function add_input(HTMLInput $input) : void $this->inputs[] = $input; } + public function add_select(HTMLSelect $select) : void + { + $this->selects[] = $select; + } + public function add_button(HTMLButton $button) : void { $this->buttons[] = $button; @@ -61,6 +69,12 @@ public function to_string() : ?string $ret .= "
".PHP_EOL; } + foreach ($this->selects as $select) + { + $ret .= $select->to_string(); + $ret .= "
".PHP_EOL; + } + foreach ($this->buttons as $button) { $ret .= $button->to_string(); diff --git a/html/HTMLOption.php b/html/HTMLOption.php new file mode 100644 index 0000000..7ecaa4c --- /dev/null +++ b/html/HTMLOption.php @@ -0,0 +1,43 @@ +value = $value; + $this->text = $text; + } + + public function to_string() : string + { + return "".PHP_EOL; + } + + public function print() : void + { + echo $this->to_string(); + } +} diff --git a/html/HTMLSelect.php b/html/HTMLSelect.php new file mode 100644 index 0000000..ce946e7 --- /dev/null +++ b/html/HTMLSelect.php @@ -0,0 +1,58 @@ + $options **/ + public array $options; + + function __construct(string $name) + { + $this->name = $name; + $this->options = array(); + } + + public function add_option(HTMLOption $option) : void + { + $this->options[] = $option; + } + + public function to_string() : string + { + $ret = "".PHP_EOL; + + return $ret; + } + + public function print() : void + { + echo $this->to_string(); + } +}