Insert Data into Database and display it with CodeIgniter
<p>I am new to CodeIgniter</p>

<p>I have the following code in my Model:</p>

<pre><code>public function saveVar() {

    $variable_limit=$this-&gt;input-&gt;post('var');
    $data = array(
        'variable_limit'=&gt;'$variable_limit'
    );

    $this-&gt;db-&gt;insert('mytable',$data);

}
</code></pre>

<p>this should fetch Data from html form and insert a row 'variable_limit' into the table 'mytable', the code doent work I see no change in the mysql database.</p>

<p>Assumed that the first code works, I want to display this data to the view, I wrote this Code in my Controller:</p>

<pre><code>    function postVar(){

            $this-&gt;load-&gt;model('tool');
            $this-&gt;tool-&gt;saveVar();
        }
</code></pre>

<p>I am trying to transfer the data to the model calling 'tool' by calling the saveVar() which is implemented in my model, does this Code work?</p>

<p>Edit: this is the Code in my View:</p>

<pre><code>&lt;form id="myform" action="&lt;?php echo base_url()."tools/file";?&gt;" method="post" onsubmit="return validateData();"&gt;
</code></pre>

<p></p>

<pre><code>&lt;div&gt; Variable : &lt;input type="number" id="var" name="var" value="&lt;?php echo isset($_POST['var']) ? $_POST['var'] : '' ?&gt;" /&gt;&lt;/div&gt;
</code></pre>

<p>Thanks, Elmoud</p>