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 7983103
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T10:51:44+00:00 2026-06-04T10:51:44+00:00

i am stuck in segments in codeigniter because it is new to me, the

  • 0

i am stuck in segments in codeigniter because it is new to me,
the problem with my login form.

i gave the url in action like action="blog/login/getLog" and
my login form shows in the url like blog/login

i know that in controller class i just create a function like with the name login but i created my controller file like this:

class Blog extends CI_Controller{
function __construct(){
    parent::__construct();
}

// Now See
function _remap( $method ){
    $this->load->view('header');

    switch( $method ){
        case 'about':
            $this->load->view('about');
            break;
        case 'login':
            $this->load->view('login');
            break;
        case 'services':
            $this->load->view('service');
            break;
    }

    $this->load->view('footer');
}
}//Close Class

but now don’t know how to handle both segment like login and login/getLog .

EDIT: What happen exactly, when i click on the login button then i just see the login form according to _remap() and the url like blog/login and when i submitted the form and the url looking like blog/login/getLog, the login form still looking but i want to redirect it on success.. or want to detect the segment getLog if possible in the case 'login': if possible.

Thanks in advanced.

  • 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-04T10:51:45+00:00Added an answer on June 4, 2026 at 10:51 am

    If you are sending through the URL, just use uri class:

    $var = $this->uri->segment(3);
    

    If you are sending in a form, send the variable through the form. Perhaps a hidden field?

    $var = $this->input->post('var_name');
    

    Edit: I’m not quite sure why you are using _remap for this w/o routing to another function (you are only trying to call a view file instead)

    This is how I would expect to see the login form:

    <?php echo form_open('blog/login');?>
    <input type="hidden" name="getLog" value"true" />
    <input type="submit" value="Login" />
    </form>
    

    Then in your Blog class i would rather put a function

    public function login() {
        if($this->input->post('getLog') === "true") {
            //the form was submitted, let's check the login?
        }
        else {
            //probably don't need an else, but form isn't submitted
        }
    }
    

    Edit 2:

    In case there are confusions and you actually want to use remap. You can do it like this to get the variables also.

    function _remap( $method ) {
      if ($method == ‘something’) {
         $this->something();
      } 
      else {
          $this->somethingelse();
      }
    }
    
    function something() {
      $var1 = $this->uri->segment(3);
      $var2 = $this->input->post('some_variable_name');
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using several response segments which I push on my action stack like this:
I stuck with problem of mail application , i am developing a website for
Im stuck with this little project in C# but basically my problem is this:
im stuck with a problem im basically trying to create a function where I
It's feel like I'm stuck, my friends. Can somebody explain me pick equations from
I am stuck how to repopulate a hidden field in a form after an
Kinda stuck here... I have an application with lets say 5000 rows of data
Got stuck here: http://jsfiddle.net/UFkg8/ Right now the animation is top-down. What do I need
I stuck while trying to compile qpid c++ with boost 1_47_0 using Visual Studio
I've been stuck trying to figure out why a counter cache on my (parent)

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.