Reputation: 2763
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?
Upvotes: 1
Views: 28940
Reputation: 9
$this->load->helper('form');
in view page
or autoload the file go to application/config/autoload
there you will find
$autoload['helper'] = array('');
$autoload['helper'] = array('form');
//input from helper it will allow in both view and controller page
Upvotes: 1
Reputation: 95
You must load helper file form for form usage on codigniter like this.
$this->load->helper('form');
Upvotes: 3
Reputation: 146
Refer to CodeIgniter User Guide, 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.
Upvotes: 2
Reputation: 6852
Did you load form helper in your controller where you call your simple form view?????
$this->load->helper('form');
Upvotes: 8