[eluser]Ingonyama[/eluser]
Hi, Im trying to use the insert method but its looking for a "submit" column in the database (obviously from the submit button).
Error message is:
"Unknown column 'submit' in 'field list'"
INSERT INTO `categories` (`name`, `description`, `submit`) VALUES ('test', 'test123', '')
Controller:
Code:
function add_category()
{
$data['heading'] = 'Add category';
if ($_POST)
{
echo 'Post submitted<br />';
print_r($_POST);
$this->db->insert('categories', $_POST);
}
$this->load->view('admin/categories/add_category', $data);
}
View:
Code:
<h1><?php echo $heading; ?></h1>
<?php echo form_open('admin/add_category'); ?>
<dl>
<dt><label for="name" id="name_label"></label></dt>
<dd><?php echo form_input('name'); ?></dd>
<dt><label for="description" id="description_label"></label></dt>
<dd><?php echo form_input('description'); ?></dd>
<dd><?php echo form_button('submit', 'Submit'); ?></dd>
</dl>
<?php echo form_close(); ?>
Thanks for any help.