From 46541e04b8608980715924dba869b855218d81bf Mon Sep 17 00:00:00 2001 From: creme332 <65414576+creme332@users.noreply.github.com> Date: Thu, 16 May 2024 16:24:32 +0400 Subject: [PATCH] replace POST superglobal with global variable --- src/views/Register.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/views/Register.php b/src/views/Register.php index 84e508e3..e26a6373 100644 --- a/src/views/Register.php +++ b/src/views/Register.php @@ -6,6 +6,7 @@ /** * Form for entering user details. + * @var bool $form_submitted Whether form was just submitted * @var bool $editMode Whether form is being used for editing * @var string $defaultFirstName * @var string $defaultLastName @@ -26,10 +27,10 @@ * @param $input_name string value in name attribute of input tag * @return string */ -$ariaInvalid = function (string $input_name) use ($errors) { +$ariaInvalid = function (string $input_name) use ($errors, $form_submitted) { // if form is loaded for the first time (form has not been submitted) // do not add aria-invalid attribute - if (!isset($_POST['form_submit'])) { + if (!$form_submitted) { return ''; }