?" name="description" /> ?" />
56961

form_open() not working in codeigniter

Question:

I am trying to build a simple form in CodeIgniter. My VIEW 'input_view.php' is:

<html> <head> <link rel="stylesheet" type="text/css" href="<?php echo "$base/$css"?>"> </head> <body> <div id="header"> <?php $this->load->view('books_header'); ?> </div> <div id="menu"> <?php $this->load->view('books_menu'); ?> </div> <?php //echo $title; ?> <?php echo form_open('books/input'); ?> <?php echo $title; ?> <?php echo form_input('title'); ?>; <?php echo $author; ?> <?php echo form_input('author'); ?> <?php echo $publisher; ?> <?php echo form_input('publisher'); ?> <?php echo $year; ?> <?php echo form_dropdown('year',$years); ?> <?php echo $available; ?> <?php echo form_checkbox('available','yes',TRUE); ?> <?php echo $summery; ?> <?php echo form_textarea('summery'); ?> <?php echo form_submit('mysubmit', 'Submit'); ?> <?php echo form_close(); ?> <div id="footer"> <?php $this->load->view('books_footer'); ?> </div> </body> </html>

But when I tried http://localhost/CodeIgniter/index.php/books/input, it does not show the form, instead shows page upto menu. Whats the problem here?

Answer1:

Did you load form helper in your controller where you call your simple form view?????

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

Answer2:

You must load helper file form for form usage on codigniter like this.

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

Answer3:

Refer to <a href="http://ellislab.com/codeigniter/user-guide/helpers/form_helper.html" rel="nofollow">CodeIgniter User Guide</a>, you must load form helper before do it like this

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

You may put that syntax on your Controller or at top of your View before you use form_open, form_input or anything else.

Answer4:

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

in view page

or autoload the file go to application/config/autoload

there find

$autoload['helper'] = array(''); $autoload['helper'] = array('from'); //input from helper it will allow in both view and controller page

Recommend

  • Javascript (MVC) load image (byte array) from database
  • JQuery Auto-Complete: How do I handle modifications?
  • Why does the following throw an “Object doesn't support property or method 'importNode
  • Angular - routerLinkActive and queryParams handling
  • Responsive left sidebar open close
  • Prevent page break in text block with iText, XMLWorker
  • cell spacing in div table
  • Why am I getting a “405 Method not allowed” error on “Put” operations through a WCF Resful service?
  • Why isn't obj.style.left = “200px”; working in this code?
  • CSS bleed-through with cfinput type=“datefield”
  • Spring: No transaction manager has been configured
  • Kendo barchart category labels left and right based on value
  • pillow imaging ImportError
  • accepts_nested_attributes_for practical form use for in Rails 3
  • C# program and C++ DLL compiled for 32-bit system crash on 64-bit system
  • Object and struct member access and address offset calculation
  • Bypass multiple inheritance in Java
  • How to view images from protected folder with php?
  • How does document.ready work with angular element directives?
  • wxPython: displaying multiple widgets in same frame
  • Loading .coffee files via a view in Rails
  • Create DicomImage from scratch using Dcmtk
  • Textfile Structure (tables)
  • Play WS (2.2.1): post/put large request
  • FileReader+canvas image loading problem
  • Insert into database using onclick function
  • Deselecting radio buttons while keeping the View Model in synch
  • Deleting and Updating values from a cusrsor adapter
  • Why HTML5 Canvas with a larger size stretch a drawn line?
  • Window Size for Mac application
  • vba code to select only visible cells in specific column except heading
  • Warning: Can't call setState (or forceUpdate) on an unmounted component
  • Cannot Parse HTML Data Using Android / JSOUP
  • json Serialization in asp
  • Rails 2: use form_for to build a form covering multiple objects of the same class
  • How get height of the a view with gone visibility and height defined as wrap_content in xml?
  • Getting Messege Twice Using IMvxMessenger
  • How to stop GridView from loading again when I press back button?
  • How to Embed XSL into XML
  • How to load view controller without button in storyboard?