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

  • Home
  • SEARCH
  • 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 8071615
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T13:44:39+00:00 2026-06-05T13:44:39+00:00

I currently have an issue with my URI’s Example I have a function called

  • 0

I currently have an issue with my URI’s

Example I have a function called add – users/add if there is an error with my input form it displays the errors on the users/add page but if all is good it goes back to the users page and shows a success but the uri remains /users/add and I have to re navigate to the users page.

Update:

add:

 $data['message'] = '<div class="alert alert-success"><strong>Thank You</strong> Your User Has Been Added</div>';
   $this->session->set_userdata('message', $data['message']);
   redirect(site_url('dashboard/users'));

users:

$message = $this->session->userdata('message');

        if($message === FALSE)
        {
            $message='';
        }else{
            $this->session->unset_userdata('message');
        }

Original:

Controller:

public function add()
        {
            $this->form_validation->set_rules('userFirstName','First Name', 'required|trim|max_length[99]|xss_clean');
            $this->form_validation->set_rules('userLastName','Last Name', 'required|trim|max_length[99]|xss_clean');
    $this->form_validation->set_rules('userEmail','E-Mail', 'required|valid_email|trim|max_length[99]|xss_clean|is_unique[users.email]');
            $this->form_validation->set_rules('userPassword','Password', 'required|trim|max_length[99]|xss_clean');

            if($this->form_validation->run() === TRUE)
                {
                    $userData = array(
                        'fName' => $this->input->post('userFirstName', TRUE),
                        'lName' => $this->input->post('userLastName', TRUE),
                        'email' => $this->input->post('userEmail', TRUE),
                        'password' => sha1($this->input->post('userPassword', TRUE))
                    );  

                    $this->db->escape($userData);
                    $this->user_model->addUser($userData);

                    $data['contentMangement'] = $this->options_model->systemOptions();
                    $data['pageTitle'] = 'Add User';
                    $data['message'] = '<div class="alert alert-success"><strong>Thank You</strong> Your User Has Been Added</div>';
                    $this->load->view('_assets/dashHeader', $data);
                    $this->load->view('dashboard/users', $data);
                    $this->load->view('_assets/footer');

                }elseif($this->form_validation->run() === FALSE)
                {
                    $data['contentMangement'] = $this->options_model->systemOptions();
                    $data['pageTitle'] = 'Add User';
                    $data['message'] = validation_errors('<div class="alert alert-error">', '</div>'); 
                    $this->load->view('_assets/dashHeader', $data);
                    $this->load->view('dashboard/addUser', $data);
                    $this->load->view('_assets/footer');
                }
        }
  • 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-06-05T13:44:41+00:00Added an answer on June 5, 2026 at 1:44 pm

    This happens because you are not redirecting away from your current page. You are merely loading the ‘users’ view from users/add.

    Think of it this way: The page you are at is users/add. What content this page shows is determined by which view(s) you load. So, even though you load the user view, you’re still at the page users/add.

    If you want to redirect, instead of

    $this->load->view('dashboard/users',$data);
    

    You need to do

    redirect(site_url('users')); //or whatever your controller is called
    

    However, in the latter case, you cannot pass data as you do when you load a view. If you want to retain data after a redirect, you will need to store it in session.

    So, in your above code, where you create $data[‘message’], add it to the session:

    $this->session->set_userdata('message',$data['message']);
    

    When you redirect, at the other controller, retrieve the message, and remove it from session:

    $message = $this->session->userdata('message');
    
    if ($message === FALSE) {
       // message was not present in session
       $message = '';
    } else {
        $this->session->unset_userdata('message');
    }
    

    EDIT

    In your edit, in the users controller, you are extracting the message from session. But, it’s not available to the view. You still need to pass it on.

    $message = $this->session->userdata('message');
    
    if($message === FALSE)
    {
        $message='';
    } else {
        $this->session->unset_userdata('message');
    }
    
    //at this point, message is only available to the controller
    // lets send it to the view
    
    $data['message'] = $message;
    $this->load->view('yourView',$data);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have a issue with firefox, where all other browser behave in the
I'm having an issue with multiple markers on google maps - I currently have
Okay, so I have an issue with an AJAX request. I currently have this
I currently have an issue with setting a cookie in a block of php
I have an issue with my divs. I currently have four divs in html
I have a current URI which filters my search results in the form of
I'm currently facing a database query issue. I have two tables, items and details
I'm currently have an issue trying to edit the Text inside my Document.Contents.Text The
Technology used: .NET 2008, C#, winforms So I currently have an issue. I have
Here's my issue: I have a html form that after a user fills in

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.