致命错误:调用c中的未定义函数form_open() [英] Fatal error: Call to undefined function form_open() in c

查看:361
本文介绍了致命错误:调用c中的未定义函数form_open()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到这个错误,并知道我错了我错了我是新的codeigniter,所以我相信它的东西愚蠢的任何人都可以预先tnx这个出来。

i got this error and daunt know where i went wrong i am new to codeigniter so i am sure its something stupid can anyone figure this out tnx in advance.

create_view.php

create_view.php

     <body>
        <?php echo form_open('create'); ?>
        <ul id="accordion">
 <li>
   <a>Survey Creation</a>
     <ul id="survay">  
       <li>Enter a question:<?php echo form_input('Question')?></li>
       <li>Answer A: <?php echo form_input('qA' );?></li>
       <li>Answer B: <?php echo form_input('qB' );?></li>
       <li>Answer C: <?php echo form_input('qC' );?></li>
       <li><?php echo form_submit('submit', 'Set This Question' );?></li>
      </ul>  
  </li>


php

 <?php

class Create extends CI_Controller{

    function index(){

        $this->load->view('create_view');
    }
    // insert data
    function create1()
    {   
     $data = array(
         'Question' => $this->input->post('Question'),
         'qA' => $this->input->post('qA'),
         'qB' => $this->input->post('qB'),
         'qC' => $this->input->post('qC'),


         );


          $this->create_model->add_record($data);
          $this->home();

    }



 }

?>


推荐答案

似乎您忘了加载格式助手。在加载视图之前,使用 application / config / autoload.php 或将以下行添加到控制器中:

Seems like you forgot to load the form helper. Use the application/config/autoload.php or add the following line into your controller before loading the view:

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

这篇关于致命错误:调用c中的未定义函数form_open()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆