diff --git a/form.php b/form.php index 03666c5..6fbaf64 100644 --- a/form.php +++ b/form.php @@ -276,24 +276,32 @@ class formfield $this->titles = array (""); foreach ($this->titles as $key=>$val) { - $res .= "
"; - $res .= " name, ENT_QUOTES)."][$key]'"; - $res .= " value='unset'"; + $res .= htmlspecialchars ($this->name, ENT_QUOTES)."]"; + if (count ($this->titles) > 1) + $res .= "[$key]"; + $res .= "' value='unset'"; $res .= "/>"; $res .= "name, ENT_QUOTES)."][$key]'"; - $res .= " id='$this->formName"."_"; - $res .= htmlspecialchars ($this->name, ENT_QUOTES)."_$key'"; + $res .= htmlspecialchars ($this->name, ENT_QUOTES)."]"; + if (count ($this->titles) > 1) + $res .= "[$key]"; + $res .= "' id='$this->formName"."_"; + $res .= htmlspecialchars ($this->name, ENT_QUOTES); + if (count ($this->titles) > 1) + $res .= "_$key"; + $res .= "'"; if (isset ($this->readonly) && $this->readonly !== FALSE) $res .= " disabled='disabled'"; - if (isset ($this->values[$key]) && - $this->values[$key] !== "unset") + if (count ($this->titles) === 1 && isset ($this->values) && + $this->values !== "unset") $res .= " checked='checked'"; - elseif (isset ($this->defaults[$key]) && - $this->defaults[$key] !== "") + elseif (isset ($this->values[$key]) && $this->values[$key] !== "unset") + $res .= " checked='checked'"; + elseif (isset ($this->defaults[$key]) && $this->defaults[$key] !== "") $res .= " checked='checked'"; if (isset ($this->hidden) && $this->hidden !== FALSE) $res .= " style='display:none'"; @@ -304,14 +312,14 @@ class formfield } $res .= "/>"; $res .= "$val\n"; - $res .= "
\n"; + $res .= " \n"; } if (isset ($this->errors) || isset ($this->help)) { $res .= " "; - if (isset ($this->help)) $res .= $this->help."
\n"; + if (isset ($this->help)) $res .= $this->help."
"; if (isset ($this->errors)) $res .= $this->errors[1]; $res .= "
\n"; }