2015-12-18 37 views
1

我想創建一個主頁,它包含一個下拉列表,其中包含2個選項:新功能和新建項目以及提交按鈕。我的重定向()函數無法使用CodeIgniter

當U選擇新的功能選項,並點擊提交按鈕,系統重定向到一個頁面通話功能頁面

當U選擇新建項目選項,並點擊提交按鈕,系統重定向到一個頁面調用項目頁面

我的問題:redirect()功能不起作用,系統重定向到一個頁面時

請看看我的代碼:

public function home() 
{ 

     $this->load->helper('url'); 

     if ($this->input->post()) 
     { 
      if ($_POST ['ProductType'] == "feature") { 

       echo "sdfsdfsd 1"; 
       redirect(base_url('feature/index')); 
      } else { 
       echo "sdfsdfsd 2"; 
       redirect(base_url('project/index')); 
      } 
     } else 
     { 
      $this->load->helper ("form"); 
      $data ['title'] = 'Welcome to Estimation tool'; 
      $data ['header'] = 'Welcome to Estimation tool'; 

      $data ['options'] = array (
        'feature' => 'New Feature', 
        'project' => 'New Project' 
      ); 

      $this->load->view ('welcome_message', $data); 
     } 
    } 

我很感激你能否幫我解決我的問題!

+0

帶走公共盈方的功能 –

+0

這是否行得通? –

+0

沒有:(它仍然顯示白色的空白頁 – Jenny

回答

0

無需在重定向中包含base_url

redirect('controller_name/method_name'); 
+0

它不起作用 – Jenny

+0

你的POST名稱是什麼? –

+0

here:if($ this-> input-> post()) –