Welcome Guest, Not a member yet? Register   Sign In
Redirection Help
#1

[eluser]LifeSteala[/eluser]
Hi guys, small question.

Consider this code:

Code:
class Myclass extends MY_controller {
function Myclass {
// Do stuff here
// Display a view which contains a link:
// Link to /myclass/remove/value/
}

function remove() {
$val = $this->uri->segment(3);
if ( empty($val) ) {
redirect('/myclass/', 'location');
}
}
}

The main controller loads a default view:

/url/myclass/

which has a link to remove an item lets say. After I click the link it takes me to:

url/myclass/remove/3

From here, if a value is not present I want it to redirect to the default view

url/myclass/

How is this done? Currently it takes me to:

url/myclass/3/myclass

Thanks
#2

[eluser]LifeSteala[/eluser]
Oh - I'm sorry Smile

My fault!! All my linking and a form action was wrong. It does work just didn't set the other stuff properly.

SOLVED




Theme © iAndrew 2016 - Forum software by © MyBB