[eluser]Unknown[/eluser]
Hey everyone, I'm having an issue I hope you can help me with.. I am just starting with codeigniter and have been diligently following the blog screencast, step by step, however when submitting the comment form y run into the following problem:
It seems by submitting the form the submit button is also being passed on as a field to the database causing the following error message to display:
A Database Error Occurred
Error Number: 1054
Unknown column 'submit' in 'field list'
INSERT INTO `comments` (`entry_id`, `body`, `author`, `submit`) VALUES ('2', 'dfgdg', 'fdsf', '')
I finally got it to work by creating a field called submit on the DB, but obviously this is not normal. Am I making a NOOB mistake, I have gone through all the code and have been able to figure it out.
Anybody have any insight, btw I apologize in advance if this is a dumb question, but your help is throughly appreciated.
Below my code.
View
Code:
<?=form_open('blog/comment_insert');?>
<?=form_hidden('entry_id', $this->uri->segment(3)); ?>
<p><textarea name="body" rows="10"></textarea></p>
<p><input type="text" name="author" /></p>
<?php echo form_submit('submit')?>
</form>
Controller
Code:
function comment_insert()
{
$this->db->insert('comments', $_POST);
redirect('blog/comments/'.$_POST['entry_id']);
}
A Database Error Occurred
Error Number: 1054
Unknown column 'submit' in 'field list'
INSERT INTO `comments` (`entry_id`, `body`, `author`, `submit`) VALUES ('2', 'dfgdg', 'fdsf', '')
[/b]