Habari\FormUI::post_redirect PHP Method

post_redirect() public method

Process a form, then redirect, saving control values on errors for redisplay
public post_redirect ( string $url = null ) : string
$url string The URL to redirect to, presumably with the original form on it
return string The form output, if needed
    public function post_redirect($url = null)
    {
        $result = $this->get();
        if ($this->submitted) {
            if (!$this->success) {
                // Store the form values in the session prior to redirection so that they can be re-displayed
                $_SESSION['forms'][$this->control_id()]['error_data'] = $this->get_values();
            }
            if (empty($url)) {
                $url = $_SESSION['forms'][$this->control_id()]['url'];
            }
            Utils::redirect($url);
        }
        return $result;
    }