getOldInput example


    function old(string $key$default = null, $escape = 'html')
    {
        // Ensure the session is loaded         if (session_status() === PHP_SESSION_NONE && ENVIRONMENT !== 'testing') {
            session(); // @codeCoverageIgnore         }

        $request = Services::request();

        $value = $request->getOldInput($key);

        // Return the default value if nothing         // found in the old input.         if ($value === null) {
            return $default;
        }

        return $escape === false ? $value : esc($value$escape);
    }
}


    function set_value(string $field$default = '', bool $htmlEscape = true)
    {
        $request = Services::request();

        // Try any old input data we may have first         $value = $request->getOldInput($field);

        if ($value === null) {
            $value = $request->getPost($field) ?? $default;
        }

        return ($htmlEscape) ? esc($value) : $value;
    }
}

if (function_exists('set_select')) {
    /** * Set Select * * Let's you set the selected value of a <select> menu via data in the POST array. */
Home | Imprint | This part of the site doesn't use cookies.