CodeIgniter Sending Arguments redirect() (CSAR)

I used to be confused about using CodeIgniter's redirect() function, where I wanted to call the controller function along with its parameters, but because of my stupidity, an error occurred, because at that time what I did was like this:

redirect(base_url() . 'MainController/Student_Login($user_email)')

Here MainController is the name of the Controller, Student_Login is a function while $user_email is a variable that stores the user's email id.

Just looking at the code, you can see how stupid I was at that time, naming functions that did not follow the naming conventions that are standard for all programmers in any part of the world.

Completion

Using redirect() is not like load->view(). Using redirect() should be as easy as calling uri segment, so the parameter of redirect() is uri segment. Here is a correct example:

redirect('mainController/Student_Login/'.$user_email)

Okay, after reading this post, hopefully you won't be infected with stupidity like me, good luck!


Post a Comment

Previous Next

نموذج الاتصال