Welcome Guest, Not a member yet? Register   Sign In

I can't get redirect() to work. Is this yet to be worked on? I get a 'Unable to locate a valid route' error.

The route works form the browser's command box. 


<?php namespace App\Controllers;

use CodeIgniter\Controller;

class Register extends Controller
    private $session;
    private $validation;

    public function __construct(...$params) {
        $this->validation =  \Config\Services::validation();
        $this->session = \Config\Services::session();

    public function index()
        print view('header.php', ['current' => 'register', 'title' => 'Register']);
        print view('register.php');
        print view('footer.php');


    public function step1()
        $messages = [
           'name' => ['required' => 'The Name field is required'],
           'mailing-address-1' => ['required' => 'Street Address 1 is required'],
           'city' => ['required' => 'The City field is required'],
           'state' => ['required' => 'The State field is required'],
           'zip' => ['required' => 'The Zip field is required'],
            'name' => 'required',
            'mailing-address-1' => 'required',
            'city' => 'required',
            'state' => 'required',
            'zip' => 'required',
        ], $messages);

        if (! $this->validation->withRequest($this->request)->run())
            print view('header.php', ['current' => 'register', 'title' => 'Step 1']);
            print view('step1.php', ['validation' => $this->validation]);
            print view('footer.php');

    public function step2()
        print "<pre>" . print_r($this->session->get(), TRUE) . "</pre>";
Simpler is always better

Oops, someone else has the same problem. I guess it isn't fixed yet. Sorry.
Simpler is always better

No one entered a bug report so it slipped my mind. Will work on it tonight, though. In the meantime - try it without the leading '/' and you should be fine.

Just added some more tests and everything seems to be working as expected. There was a fix directly related to what you're seeing that was added a couple of days ago. Please pull down the latest version of the CI4 and try again.

Theme © iAndrew 2016 - Forum software by © MyBB