CodeIgniter Forums
need help on storing checkbox values to a table - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: need help on storing checkbox values to a table (/showthread.php?tid=57221)



need help on storing checkbox values to a table - El Forum - 02-27-2013

[eluser]ede196620[/eluser]
hi everyone i am new to codeigniter. currently i am working on my first project with codeigniter i am trying to build a small survay website nothing impressive something simple. currently i am stuck in one place trying to save check box values to a table in database cant figure this one out. so my question is how can i store check box values in to a table on to a database using the cmv ? i already created a controller a model and a view for retrieving questions stored in the database and displayed on a web page all i need is to find out how can i store check box values using cmv ? tnx for you help in advance.


here is my view page:

Code:
<html>
    
  <body>
      
    <?php form_open('survay'); ?>  
    <?php foreach($survay_data as $survay):?>
    <ul>
        <li><h1>&lt;?php echo $survay->Question; ?&gt;</h1></li>
        <li>&lt;?php echo $survay->qA; ?&gt;&lt;input type="checkbox" name = "q1" value = "qA"&gt;&lt;/li>
        <li>&lt;?php echo $survay->qB; ?&gt;&lt;input type="checkbox" name = "q2" value = "qB"&gt;&lt;/li>
        <li>&lt;?php echo $survay->qC; ?&gt;&lt;input type="checkbox" name = "q3" value = "qC"&gt;&lt;/li>
      </ul>  
    &lt;?php endforeach; ?&gt;
    &lt;input type="textarea" value='a' name="comment"&gt;
    <br>
    &lt;?php echo form_submit('submit', 'Submit survay'); ?&gt;
    
    &lt;/body&gt;
    &lt;/html&gt;

if u know any tutorials out there that provide an example how to do this can u post them tnx again.
if requested i can also post my controller and my model.