2011-05-27 65 views
-1

我有一個控制器index()newFunction()。當我的索引函數加載時,它會加載我需要的第一個視圖。我有一個提交該視圖按鈕:在CodeIgniter中提交到新的觀點

<div class="btn"><input type="submit" name="submit" id="submit_button" value="Pay"></input></div> 

我想要提交按鈕加載newFunction(),作爲新的一頁,現在它被加載索引視圖下newFunction() /視圖。

這就是我在我的索引函數中調用嘗試獲取新視圖以加載爲新頁面。除了它在它下面加載它。

$submit = $this->input->post("submit"); 
if($submit == "Pay") { 
    $this->pay($postData);//pay is the name of newFunction(); 
} 

回答

0
public function index() 
{ 
    if($this->input->post("submit") == "Pay") 
    { 
     $this->pay($postData);//pay is the name of newFunction(); 
     return; // With this, rest of the code wont execute. 
    } 
} 
+0

這樣,我只是必須確保這正好之前我加載索引功能正確索引/視圖? – Technupe 2011-05-27 13:48:49

+0

正好。更改代碼以獲取更少的資源。 – Valour 2011-06-06 14:45:14