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