protected function getValueAttr() { switch (classUnqualified(get_class($this))) { case 'Input': $type = 'text'; break; case 'Textarea': $type = 'textarea'; break; case 'Checkbox': $type = 'checkbox'; break; case 'Radio': $type = 'radio'; break; case 'Select': $type = 'select'; break; } $value = stringIndex($_POST, $this->name); if ($value != '__UNSET_ELEMENT' && $value !== '') { return formState($type, uh($value), isset($this->compare_value) ? $this->compare_value : null); } else { if ($this->default_value !== '') { return formState($type, uh($this->default_value), isset($this->compare_value) ? $this->compare_value : null); } } }
function formStatePost($key, $type, $compare = '', $default = '') { $value = stringIndex($_POST, $key); if ($value != '__UNSET_ELEMENT' && $value !== '') { echo formState($type, uh($value), $compare); } else { if ($default !== '') { echo formState($type, uh($default), $compare); } } }