Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
589 views
in Technique[技术] by (71.8m points)

php - Fatal error: Call to undefined function form_open() in c

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

     <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>

create.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();

    }



 }

?>
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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');

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...