2013-03-22 79 views
0
<?php 
class Customer extends CI_controller 
{ 

public function __construct() 
{ 
    parent::__construct(); 
    $this->load->model('Customer_model'); 


} 
public function create() 
{ 

    $this->load->helper('form'); 
    $this->load->library('form_validation'); 
    $this->form_validation->set_rules('name', 'Title', 'required'); 
    $this->form_validation->set_rules('address', 'text', 'required'); 

    if ($this->form_validation->run() === FALSE) 
    { 

    $this->load->helper('url'); 
    $this->load->view('templates/header'); 
    $this->load->view('master/customer'); 

    } 
    else 
    { 
    $this->Customer_model->register(); 

    $this->load->view('templates/header'); 
    $this->load->view('templates/success'); 
    } 
    } 
} 

我已经使用此代码成功地将数据插入表中。在我尝试显示相同的页眉模板和中心部分(success.php)后,它显示一个空白页面。在标题页面发表评论之后,它正在工作I.E.成功的页面即将到来。空白页原因

+0

然后上传你的头页面代码也。您可能显示了一些定义的值。 – 2013-03-22 11:00:11

+1

您的标题页可能有语法错误。无论问题是什么,答案都在服务器错误日志中。 – DaveRandom 2013-03-22 11:00:44

+0

您是否使用FastCGI来运行PHP脚本? – TheJSB 2013-03-22 11:04:18

回答

0

我认为你需要loadhelper也是它上面:

$this->load->helper('url');