Compare commits
4 Commits
0.1.3
...
53e5fadfc1
Author | SHA1 | Date | |
---|---|---|---|
53e5fadfc1 | |||
9dfb6a52c3 | |||
45e57367d3 | |||
ddb17cc473 |
@ -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 "<form method='POST' action='$action'>";
|
||||
echo "<form method='POST' action='$action' enctype='$enctype'>";
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -12,10 +12,18 @@ trait CreateOption
|
||||
public function createOption(array $options, $value = null): string
|
||||
{
|
||||
$optionsString = "";
|
||||
if (is_array($value)) {
|
||||
foreach ($options as $val => $title) {
|
||||
$selected = in_array($title, $value) ? "selected" : "";
|
||||
$optionsString .= "<option $selected value='$val'>$title</option>";
|
||||
}
|
||||
} else {
|
||||
foreach ($options as $val => $title) {
|
||||
$selected = (int)$value === $val ? "selected" : "";
|
||||
$optionsString .= "<option $selected value='$val'>$title</option>";
|
||||
}
|
||||
}
|
||||
|
||||
return $optionsString;
|
||||
}
|
||||
}
|
@ -15,7 +15,7 @@ trait CreateParams
|
||||
{
|
||||
$paramsString = "";
|
||||
foreach($data as $key => $param){
|
||||
if(is_string($param)){
|
||||
if(is_string($param) || is_numeric($param)){
|
||||
$paramsString .= $key . "='" . $param . "'";
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user