Closed wtom closed 9 years ago
Hi. Thanks for your contribution but I think this is not a good idea for some reasons:
$_SERVER
and $_GET
so it's not testable in other environments$_GET['submit']
variableI think each implementation should check whether the form has been sent or not in it's own way:
if (strtolower($_SERVER['REQUEST_METHOD']) == 'post') {
$form->loadFromGlobals();
if ($form->isValid()) {
//do stuff
}
}
i only validate the form, if it was sent before. if i don't do it, all fields have errors on the first load.
if ($form->isSent() && $form->isValid()) { // save data }