<分区>
我有一个可以添加新类别项目的表单。
<form method="POST" action="backend/categories/form">
<input type="text" name="title" value="" />
<button type="submit">Save</button>
<button type="submit">Save and add new</button>
</form>
我想做的是,如果我点击 Save
按钮,它将在 Controller 中处理一个函数并自动将我重定向到上一页(类别列表页面),但每当我点击Save and add new
,它应该处理这个函数但是重新加载相同的页面而不重定向到 Controller 函数中定义的页面。
Controller :
function form($id){
// Process the form
// ...
// Redirect to the category list page
redirect($this->config->item('backend_folder').'/categories');
}
在不使用 Javascript 的情况下有什么技巧可以实现吗?