diff --git a/src/ActiveForm.php b/src/ActiveForm.php index ced9893..367724f 100755 --- a/src/ActiveForm.php +++ b/src/ActiveForm.php @@ -31,9 +31,9 @@ class ActiveForm * @param string $action * @return void */ - public function beginForm(string $action): void + public function beginForm(string $action, string $enctype = 'application/x-www-form-urlencoded'): void { - echo "
"; + echo ""; } /** diff --git a/src/traits/CreateOption.php b/src/traits/CreateOption.php index 0ba5071..ffc3f15 100755 --- a/src/traits/CreateOption.php +++ b/src/traits/CreateOption.php @@ -12,10 +12,18 @@ trait CreateOption public function createOption(array $options, $value = null): string { $optionsString = ""; - foreach ($options as $val => $title){ - $selected = (int)$value === $val ? "selected" : ""; - $optionsString .= ""; + if (is_array($value)) { + foreach ($options as $val => $title) { + $selected = in_array($title, $value) ? "selected" : ""; + $optionsString .= ""; + } + } else { + foreach ($options as $val => $title) { + $selected = (int)$value === $val ? "selected" : ""; + $optionsString .= ""; + } } + return $optionsString; } } \ No newline at end of file