提交到CodeIgniter中的新视图

时间:2011-05-27 13:29:45

标签: codeigniter views

我有一个带有index()newFunction()的控制器。当我的索引函数加载时,它会加载我需要的第一个视图。我在该视图上有一个提交按钮:

<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();
}

1 个答案:

答案 0 :(得分: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.
    }
}