0
votes

here is my controller file and view file of admin login section in codeignitor. all helpers files are present in root folder\system\helpers in frontend end it's ok, but in admin section it's showing the following error

Fatal error: Call to undefined function form() in D:\wamp\www\CodeIgniter\application\views\admin\catalog\catalog_view.php on line 4

I think we have to change something in or anything else???

D:\wamp\www\CodeIgniter\application\controllers\admin\catalog.php

    <?php
    /**
     * Admin Catalog Controller
     */
    class Catalog extends CI_Controller
    {
        function index()
        {   
            $this->load->helper(array('form', 'url'));
            $this->load->library('form_validation');
            $this->load->view('admin/templates/header');
            $this->form_validation->set_error_delimiters('<div class="error">', '</div>');
            $this->load->database();
            $this->form_validation->set_rules('email', 'Email', 'required|valid_email');
            $this->form_validation->set_rules('password', 'Password', 'required|valid_email');
            if ($this->form_validation->run() == FALSE)
            {
                $this->load->view('admin/catalog/catalog_view');
            }
            else
            {   
                $this->form1_model->admin_login();
                $this->load->view('admin/catalog/home_view');
            }
            $this->load->view('admin/templates/footer');
            //$html_string = $this->load->view('admin/catalog/catalog_view');
        }
    }

D:\wamp\www\CodeIgniter\application\views\admin\catalog\catalog_view.php

    <?php if (!defined('BASEPATH')) exit(__('No direct script access allowed')); ?>
    <div class="light_blue_back" align="center">
         <div class="adminbox">
         **<?php echo form('adminform'); ?>**
              <fieldset>
                <legend><b>Admin Login</b></legend>
                <dl>
                    <dt>
                        <label for="street_address1"> <span class="req">*</span>Email</label>
                    </dt>
                    <dd>
                        <input type="text"  name="email" id="email"  value=""/>
                    </dd>
                </dl>
                <dl>
                    <dt>
                        <label for="street_address2">Password</label>
                    </dt>
                    <dd>
                        <input type="password" name="password" id="password"  value=""/>
                    </dd>
                </dl>
                <dl>
                    <dt>
                    </dt>
                  <dd>
                      <input type="submit"  value="Submit"   name="reg_sub" id="reg_sub"/>
                      <input type="reset" name="reg_reset" id="reg_reset" value="Reset"  />
                  </dd>
                </dl>
            </fieldset>
        </form> 
         </div>
    </div>
1
Well, I am using CodeIgniter 2.1.3, and the form helper is invoked by form_open() not form(). Looking at the docs, there seems not to be any form() function defined. - user9645

1 Answers

0
votes

Your whole code in catalog_view.php is pure html except the form opening line. If you want to use codeigniter's form helper you need to use proper functions:

echo form_open()
echo form_input()
echo form_label()
echo form_close()

and so on. Otherwise just change line 4 to standar html form syntax and you won't get the error.