title: NULL values in codeigniter from POST
body: <p>UPDATE: </p>
  
  <pre><code>    Error Number: 42S22/1054
  
  Unknown column 'Array' in 'field list'
  
  INSERT INTO `attendance` (`event_date`, `event_time`, `event_info`, `player_id`, `is_present`, `notes`) VALUES ('2017-03-08', '11:00:00 AM', 'other', NULL, Array, 'notes')
  </code></pre>
  
  <p>'NULL' should be the 'player_id' and 'Array' should be either present or absent. Very stuck on this so thank you for all of your help so far I really appreciate it.</p>
  
  <p>I'm trying to create an attendance table which will hold a person's id and then have two columns - 1 to make for present and the other to mark for absent. So I would be adding multiple rows to the database in one go.</p>
  
  <p>I've just added code from the view because I know my controller and model is fine as the other input fields are working fine.</p>
  
  <p>For every row I want it to input the <code>player_id</code> and whether they were <code>present</code> or <code>absent</code>. In my database it is an enum <code>yes</code> or <code>no</code> for is_present. I know this is probably no where near correct so thanks for any suggestions.</p>
  
  <pre><code>&lt;div class="container-fluid"&gt;  
  &lt;div class="form-group"&gt; 
          &lt;div class=".col-xs-12 .col-md-6"&gt;
            &lt;h2 class="brand-before text-center"&gt;&lt;/h2&gt;
  &lt;table class="table table-sm table-bordered tabular_datable-condensed table-hover" id="playertable" name="player_id"&gt; 
  
    &lt;tr&gt;
    &lt;th&gt;Player ID&lt;/th&gt;
    &lt;th&gt;Player first name&lt;/th&gt;
    &lt;th&gt;Player surname&lt;/th&gt;
    &lt;th&gt;Add&lt;/th&gt;
    &lt;/tr&gt;
  
     &lt;tr class="clickable-row"&gt;
  
  &lt;?php foreach ($query-&gt;result_array() as $row): {?&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;?php echo $row['player_id'];?&gt;&lt;/td&gt;
  
          &lt;td&gt;&lt;?php echo $row['player_first_name'];?&gt;&lt;/td&gt;
  
          &lt;td&gt;&lt;?php echo $row['player_last_name'];?&gt;&lt;/td&gt;
  
  &lt;td align="left"&gt;
   &lt;label&gt;
   &lt;input type="radio" name="attendance[&lt;?php echo $row['player_id']; ?&gt;]" value="Yes" &lt;?php echo set_radio('attendance', 'Yes', TRUE); ?&gt; &gt;Present
   &lt;/label&gt;
  &amp;emsp;
   &lt;label&gt;
   &lt;input type="radio" name="attendance[&lt;?php echo $row['player_id']; ?&gt;]" value="No" &lt;?php echo set_radio('attendance', 'No', TRUE); ?&gt; &gt;Absent
   &lt;/label&gt;&lt;/td&gt;
  
      &lt;?php } ?&gt;
  &lt;?php endforeach; ?&gt;
  
  &lt;/tr&gt;
      &lt;/table&gt;
  </code></pre>
  
  <p>The controller</p>
  
  <pre><code>function add_attendance(){
  
      $event_date=$this-&gt;input-&gt;post('event_date');
      $event_time=$this-&gt;input-&gt;post('event_time');
      $event_info=$this-&gt;input-&gt;post('event_info');
      $player_id=$this-&gt;input-&gt;post('player_id');
      $is_present=$this-&gt;input-&gt;post('attendance');
      $notes=$this-&gt;input-&gt;post('notes');
  
  
      $data = array(
          'event_date'=&gt;$event_date,
          'event_time'=&gt;$event_time,
          'event_info'=&gt;$event_info,
          'player_id'=&gt;$player_id,
          'is_present'=&gt;$is_present,
          'notes'=&gt;$notes
  
  );
  </code></pre>