Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How Cake PHP redirect with parameters in url

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 3.22k
    Comment on it

    Hello readers, If you are using cakephp and want to redirect user to any other page/controller with some passing values in url, Well cakephp provides you its own syntax written in php, check bellow example:

      $this->redirect(
            array(
                  "controller" => "Controller", 
                  "action" => "user",
                  "?" => array(
                      "username" => "user123",
                      "usertype" => "staff"
                  ) ),
            $status,
            $exit
        );
    

    Here I want to pass username and usertype to my controller with values- user123 and staff.

    Finally the url will be appear like this-

    /Controller/user/?param1=val1&param2=val2
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: