Redirecting to route from controller method |
[eluser]Unknown[/eluser]
I have a controller name "HomeController" where I have the following methods: <?php class HomeController extends CI_Controller { public function __construct() { parent::__construct(); $this->load->helper('url'); $this->load->helper('captcha'); $this->load->helper('html'); $this->load->library('form_validation'); $this->load->library('cart'); $this->load->model('DatabaseModel','dm',TRUE); } public function ShipDetails() { $this->load->view('ShippingDetails'); } public function UserType() { $this->load->view("UserType"); if($this->input->post('nxt')) { $radioval=$this->input->post('Radio'); switch($radioval) { case 1: $this->UserLogin(); break; case 2: //echo "Guest User"; //redirect('tmp'); redirect('/HomeController/ShipDetails/'); break; } } } Now what I want is to redirect to the page named "ShippingDetails.php" (which is written inside the method "ShipDetails()) via router. if I am using the above code the url is showing the following: " http://localhost/Sandip/CodeIgniter/Home...hipDetails " i,e., the controller class as well as controller method.I just wanna hide the Class & method in the URL. How can I do this? Please help.Novice in PHP-CI. Is it possible to redirect to "routes" from controller method,if so how?
[eluser]jmadsen[/eluser]
yes, you can redirect to routes from the routes.php config. you just call the route. as a matter of fact, if you had tried that before coming here to ask a question about it, you would already know that. ;-) |
Welcome Guest, Not a member yet? Register Sign In |