Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7079273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:39:06+00:00 2026-05-28T06:39:06+00:00

I am having trouble trying to pass an valuable after the user fail the

  • 0

I am having trouble trying to pass an valuable after the user fail the authorization. I would like to pass $error to the welcome controller but not sure how. Please help. Thank you.

  private function _user_check()
            {
                 //after form validation, I pass username and password to the model
                    $this->load->model('user_query');
                    $result=$this->user_query->query($this->input->post('username'),$this->
                    input->post('password'));

                    if($result)
                {
                    redirect('main');

                }else{
                    // I am not sure how to pass this error message to my welcome controller
                    $data['error']='Please check your username or password';
                    redirect('welcome');
                }


        }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T06:39:06+00:00Added an answer on May 28, 2026 at 6:39 am

    In the redirect function, you aren’t providing a full URL, so CI is going to treat the parameter as an URI segments to the controller.

    Knowing this, you could have something like:

    redirect('welcome/error/error_user_pass');
    

    and have your “error_user_pass” that is being passed reference error constants defined in your CI project.

    Maybe something like this in your application/config/constants.php file:

    define('error_user_pass', 'incorrect user or password, please check yo self!');
    

    Then in your ‘welcome’ controller having something like this:

    class Welcome extends CI_Controller {
      public function error(){
        $errors = func_get_args();
        foreach( $errors as $error ){
          //echo error, or save it, or whatev
        }
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to make a dynamic function but i am having trouble because
I'm trying to implement my own list class but am having trouble reversing just
I am having trouble trying to pass an extra variable in the url to
I am trying to use Django with jquery UI autocomplete but having trouble sending
I'm having some trouble trying to pass a string from a URL to the
I'm trying to raise a toast from asynctask, but I'm having trouble getting my
I am trying to build a self-hosted PHP site, but I am having trouble
I`m having trouble trying to optimize this query with OVER (PARTITION BY ...) because
I am having trouble trying to get iterators for inner sub-containers. Basically imagine this
I am having trouble trying to connect an Infopath 2007 form to an WCF

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.