2011-05-27 64 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