title: How to pass values from view to controller on button click
body: <p>How to pass values from view to controller onclick... I need to save every row into the database </p>
  
  <pre><code>&lt;table border="1" cellpadding="4" cellspacing="0"&gt;
      &lt;tr&gt;
          &lt;td&gt;from&lt;/td&gt;
          &lt;td&gt;to&lt;/td&gt;
          &lt;td&gt;title&lt;/td&gt;
          &lt;td&gt;openletter&lt;/td&gt;
          &lt;td&gt;open_id&lt;/td&gt;
      &lt;/tr&gt;
  
      &lt;?php foreach ($r-&gt;result() as $row): ?&gt;
  
          &lt;tr&gt;
              &lt;td&gt;&lt;?php echo $row-&gt;from; ?&gt;&lt;/td&gt;
              &lt;td&gt;&lt;?php echo $row-&gt;to; ?&gt;&lt;/td&gt;
              &lt;td&gt;&lt;?php echo $row-&gt;title; ?&gt;&lt;/td&gt;
              &lt;td&gt;&lt;?php echo $row-&gt;openletter; ?&gt;&lt;/td&gt;
              &lt;td&gt;&lt;?php echo $row-&gt;open_id; ?&gt;&lt;/td&gt;
              &lt;td&gt;&lt;input type="button" value="add to archieve" onclick="&lt;?php echo $row-&gt;from; ?&gt;" /&gt;&lt;/td&gt;
              &lt;td&gt;&lt;input type="button" value="add to new" onclick="" /&gt;&lt;/td&gt;
              &lt;td&gt;&lt;input type="button" value="Discard" onclick="" /&gt;&lt;/td&gt;
          &lt;/tr&gt;
  
      &lt;?php endforeach; ?&gt;
  &lt;/table&gt;
  </code></pre>