diff --git a/main/gradebook/search.php b/main/gradebook/search.php index 041d80e726..31a9bc3c7a 100644 --- a/main/gradebook/search.php +++ b/main/gradebook/search.php @@ -19,14 +19,19 @@ if (api_get_setting('allow_public_certificates') != 'true') { ); } -$firstname = isset($_POST['firstname']) ? trim($_POST['firstname']) : null; -$lastname = isset($_POST['lastname']) ? trim($_POST['lastname']) : null; - $userId = isset($_GET['id']) ? intval($_GET['id']) : 0; $userList = $userInfo = $courseList = $sessionList = []; -if (!empty($firstname) && !empty($lastname)) { +$searchForm = new FormValidator('search_form', 'post', null, null); +$searchForm->addText('firstname', get_lang('Firstname')); +$searchForm->addText('lastname', get_lang('Lastname')); +$searchForm->addButtonSearch(); + +if ($searchForm->validate()) { + $firstname = $searchForm->getSubmitValue('firstname'); + $lastname = $searchForm->getSubmitValue('lastname'); + $userList = UserManager::getUserByName($firstname, $lastname); if (empty($userList)) { @@ -53,11 +58,6 @@ if (!empty($firstname) && !empty($lastname)) { } } -$searchForm = new FormValidator('search_form', 'post', null, null); -$searchForm->addText('firstname', get_lang('Firstname')); -$searchForm->addText('lastname', get_lang('Lastname')); -$searchForm->addButtonSearch(); - $template = new Template(get_lang('SearchCertificates')); $template->assign('search_form', $searchForm->returnForm());