关于一个让我郁闷的表单……无法成功提交
本帖最后由 拔凉拔凉的、 于 2013-12-20 13:16 编辑views>publish.php
<?=form_open('publish/submit'); ?>
<label for="title">标题</label>
<input name="title" type="text">
<label for="category">栏目</label>
<select name="category">
<option value="a">a</option>
<option value="b">b</option>
</select>
<script src="/ckeditor/ckeditor.js"></script>
<textarea id="editor1" name="contents"></textarea>
<script>CKEDITOR.replace( 'editor1' );</script>
<button type="submit">提交</button>
<?=form_close();?>
controllers>publish.php
<?php if ( ! defined("BASEPATH")) exit("No direct script access allowed");
class Publish extends CI_Controller {
public function index(){
$arr["page_tittle"] = "新闻发布页";
$this->load->view("templates/header",$arr);
$this->load->helper(array('form','url'));
$this->load->view("publish");
$this->load->view("templates/footer");
}
function submit(){
$this->load->library('form_validation');
if ($this->form_validation->run() == FALSE){
$this->load->view('myform');
}
else{
$this->load->view('formsuccess');
}
}
}
现在很郁闷的是不管你怎样提交,用怎样的方式检查都会是跳转到myform……求各位大神搭救,本人php新手……谢谢!
你的验证规则在哪? loadinger 发表于 2013-12-18 09:51 http://www.codeigniter.org.cn/forums/static/image/common/back.gif
你的验证规则在哪?
你好,谢谢回答。
但是我用if(empty($_POST["submit"]))也是不行的。
这个必须设置验证规则才可以的么?
看的文档里面木有写需要验证规则……
看看页面源码有没有 <form method="post" ...
后台判断是否post请用:
$this->input->server('REQUEST_METHOD')或者$_SERVER['REQUEST_METHOD'] 来判断。。。 $this->form_validation->run() == FALSE 可能是这里为假 form 类库没载入吧
页:
[1]