Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

    }



 }

?>
like image 224
Edvinas Liutvaitis Avatar asked Feb 25 '13 08:02

Edvinas Liutvaitis


2 Answers

You may also load this helpers on all controllers. Go your config folder and open autoload.php in any editor and then load required helper as following :

$autoload['helper'] = array('url','form');
like image 179
user3645541 Avatar answered Oct 24 '22 10:10

user3645541


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');
like image 32
complex857 Avatar answered Oct 24 '22 11:10

complex857