Help Submit Button in codeigniter forms.

#1
[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>&lt;textarea name="body" rows="10"&gt;&lt;/textarea></p>  
<p>&lt;input type="text" name="author" /&gt;&lt;/p>
&lt;?php echo form_submit('submit')?&gt;
&lt;/form&gt;
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]


Messages In This Thread
Help Submit Button in codeigniter forms. - by El Forum - 03-21-2009, 08:25 PM
Help Submit Button in codeigniter forms. - by El Forum - 03-21-2009, 09:35 PM
Help Submit Button in codeigniter forms. - by El Forum - 03-22-2009, 01:48 AM
Help Submit Button in codeigniter forms. - by El Forum - 03-22-2009, 02:04 AM
Help Submit Button in codeigniter forms. - by El Forum - 02-20-2012, 07:54 PM
Help Submit Button in codeigniter forms. - by El Forum - 02-21-2012, 09:09 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.