title: Hours spent on a ticket in osTicket?
body: <p>I've hit a roadblock with this template. I've added a dropdown for number of hours spent on a ticket, but it currently doesn't do anything. I'd like it to add an entry to the database under the hours_spent column, but I can't get it to run my query.</p>
  
  <pre><code>&lt;?php
  global $cfg;
  
  if (!$info['title'])
      $info['title'] = 'Change Tickets Status';
  
  ?&gt;
  &lt;h3&gt;&lt;?php echo $info['title']; ?&gt;&lt;/h3&gt;
  &lt;b&gt;&lt;a class="close" href="#"&gt;&lt;i class="icon-remove-circle"&gt;&lt;/i&gt;&lt;/a&gt;&lt;/b&gt;
  &lt;div class="clear"&gt;&lt;/div&gt;
  &lt;hr/&gt;
  &lt;?php
  if ($info['error']) {
      echo sprintf('&lt;p id="msg_error"&gt;%s&lt;/p&gt;', $info['error']);
  } elseif ($info['warn']) {
      echo sprintf('&lt;p id="msg_warning"&gt;%s&lt;/p&gt;', $info['warn']);
  } elseif ($info['msg']) {
      echo sprintf('&lt;p id="msg_notice"&gt;%s&lt;/p&gt;', $info['msg']);
  } elseif ($info['notice']) {
     echo sprintf('&lt;p id="msg_info"&gt;&lt;i class="icon-info-sign"&gt;&lt;/i&gt; %s&lt;/p&gt;',
             $info['notice']);
  }
  
  
  $action = $info['action'] ?: ('#tickets/status/'. $state);
  ?&gt;
  &lt;div id="ticket-status" style="display:block; margin:5px;"&gt;
      &lt;form method="post" name="status" id="status"
          action="&lt;?php echo $action; ?&gt;"&gt;
          &lt;table width="100%"&gt;
              &lt;?php
              if ($info['extra']) {
                  ?&gt;
              &lt;tbody&gt;
                  &lt;tr&gt;&lt;td colspan="2"&gt;&lt;strong&gt;&lt;?php echo $info['extra'];
                  ?&gt;&lt;/strong&gt;&lt;/td&gt; &lt;/tr&gt;
              &lt;/tbody&gt;
              &lt;?php
              }
  
              $verb = '';
              if ($state) {
                  $statuses = TicketStatusList::getStatuses(array('states'=&gt;array($state)))-&gt;all();
                  $verb = TicketStateField::getVerb($state);
              }
  
              if ($statuses) {
              ?&gt;
              &lt;tbody&gt;
                  &lt;tr&gt;
                      &lt;td colspan=2&gt;
                          &lt;span&gt;
  
                          &lt;?php
                          if (count($statuses) &gt; 1) { ?&gt;
                              &lt;strong&gt;&lt;?php echo __('Status') ?&gt;:&amp;nbsp;&lt;/strong&gt;
                              &lt;select name="status_id"&gt;
                              &lt;?php
                              foreach ($statuses as $s) {
                                  echo sprintf('&lt;option value="%d" %s&gt;%s&lt;/option&gt;',
                                          $s-&gt;getId(),
                                          ($info['status_id'] == $s-&gt;getId())
                                           ? 'selected="selected"' : '',
                                          $s-&gt;getName()
                                          );
                              }
                              ?&gt;
                              &lt;/select&gt;&lt;br&gt;
  /**
  Code I've added begins below
  **/
                              &lt;strong&gt;&lt;?php echo __('Hours Spent') ?&gt;:&amp;nbsp;&lt;/strong&gt;
                                  &lt;select required id="hours_spent" name="hours_spent"&gt;
                                  &lt;option value=""&gt;How Many?&lt;/option&gt;
                                  &lt;&lt;?php for ($i = 1; $i &lt;= 40; $i++) : ?&gt;
                              &lt;option value="&lt;?php echo $i; ?&gt;"&gt;&lt;?php echo $i; ?&gt;&lt;/option&gt;
                              &lt;?php endfor; ?&gt;
                          &lt;/select&gt;
   /**
  Code I've added ends above
  **/
                              &lt;font class="error"&gt;*&amp;nbsp;&lt;?php echo $errors['status_id']; ?&gt;&lt;/font&gt;
                          &lt;?php
                          } elseif ($statuses[0]) {
                              echo  "&lt;input type='hidden' name='status_id' value={$statuses[0]-&gt;getId()} /&gt;";
                          } ?&gt;
                          &lt;/span&gt;
                      &lt;/td&gt;
                  &lt;/tr&gt;
              &lt;/tbody&gt;
              &lt;?php
              } ?&gt;
              &lt;tbody&gt;
                  &lt;tr&gt;
                      &lt;td colspan="2"&gt;
                          &lt;?php
                          $placeholder = $info['placeholder'] ?: __('Optional reason for status change (internal note)');
                          ?&gt;
                          &lt;textarea name="comments" id="comments"
                              cols="50" rows="3" wrap="soft" style="width:100%"
                              class="richtext ifhtml no-bar"
                              placeholder="&lt;?php echo $placeholder; ?&gt;"&gt;&lt;?php
                              echo $info['comments']; ?&gt;&lt;/textarea&gt;
                      &lt;/td&gt;
                  &lt;/tr&gt;
              &lt;/tbody&gt;
          &lt;/table&gt;
          &lt;hr&gt;
          &lt;p class="full-width"&gt;
              &lt;span class="buttons pull-left"&gt;
                  &lt;input type="reset" value="&lt;?php echo __('Reset'); ?&gt;"&gt;
                  &lt;input type="button" name="cancel" class="close"
                  value="&lt;?php echo __('Cancel'); ?&gt;"&gt;
              &lt;/span&gt;
              &lt;span class="buttons pull-right"&gt;
                  &lt;input type="submit" value="&lt;?php
                  echo $verb ?: __('Submit');?&gt;"&gt;
              &lt;/span&gt;
           &lt;/p&gt;
      &lt;/form&gt;
  &lt;/div&gt;
  &lt;div&gt;
  &lt;table&gt;
  &lt;tr&gt;
  &lt;/tr&gt;
  &lt;/table&gt;
  &lt;/div&gt;
  &lt;div class="clear"&gt;&lt;/div&gt;
  &lt;script type="text/javascript"&gt;
  $(function() {
      // Copy checked tickets to status form.
      $('form#tickets input[name="tids[]"]:checkbox:checked')
      .each(function() {
          $('&lt;input&gt;')
          .prop('type', 'hidden')
          .attr('name', 'tids[]')
          .val($(this).val())
          .appendTo('form#status');
      });
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>My question is twofold. What is the function that passes the user's input to the backend database and how can I piggyback off of that function to insert my own query to update the database with hours_spent?</p>