Note that there are some explanatory texts on larger screens.

plurals
  1. POCannot insert values into database using codeigniter
    primarykey
    data
    text
    <p>trying to insert form values into database using codeigniter but nothing heppens. my form is <strong>comment_form.php</strong> is like,</p> <pre><code>&lt;?php echo validation_errors(); ?&gt; &lt;?php echo form_open('news/comment_form'); ?&gt; Name&lt;input type="text" name="comment_name"&gt;&lt;/input&gt;&lt;br /&gt; Email&lt;input type="text" name="comment_email"&gt;&lt;/input&gt;&lt;br /&gt; Comment&lt;input type="text" name="comment_body"&gt;&lt;/input&gt;&lt;br /&gt; &lt;input type="submit" name="submit" value="Comment it" &gt;&lt;/input&gt; &lt;/form&gt; </code></pre> <p>here's my controller <strong>comments.php</strong></p> <pre><code>class Comments extends CI_Controller { public function __construct() { parent::__construct(); $this-&gt;load-&gt;model('comment_model'); } public function create_comment() { $this-&gt;load-&gt;helper('form'); $this-&gt;load-&gt;library('form_validation'); //$data['title'] = 'Create a news item'; $this-&gt;form_validation-&gt;set_rules('comment_name', 'comment_name', 'required'); $this-&gt;form_validation-&gt;set_rules('comment_email', 'comment_email', 'required'); $this-&gt;form_validation-&gt;set_rules('comment_body', 'comment_body', 'required'); if ($this-&gt;form_validation-&gt;run() === FALSE) { $this-&gt;load-&gt;view('templates/header', $data); $this-&gt;load-&gt;view('news/comment_form'); $this-&gt;load-&gt;view('templates/footer'); } else { $this-&gt;news_model-&gt;set_comment(); $this-&gt;load-&gt;view('news/success'); } } } </code></pre> <p>and this is my model <strong>comment_model.php</strong></p> <pre><code>class Comment_model extends CI_Model { public function __construct() { $this-&gt;load-&gt;database(); } public function set_comment() { //$this-&gt;load-&gt;helper('url'); //$slug = url_title($this-&gt;input-&gt;post('title'), 'dash', TRUE); $datac = array( 'comment_name' =&gt; $this-&gt;input-&gt;post('comment_name'), 'comment_email' =&gt; $this-&gt;input-&gt;post('comment_email'), 'comment_body' =&gt; $this-&gt;input-&gt;post('comment_body') ); return $this-&gt;db-&gt;insert('comments', $datac); } } </code></pre> <p>the problem is whenever i submitting the form it returns nothing, like nothing happened.please help.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload