My goal is to have two buttons allocated to one form. One of the buttons, when clicked, edits the ticket, the second button deletes a ticket. The form is submitted via AJAX to a controller, which then directs the action appropriately. What I have tried so far is to send the submit value via AJAX to the controller and then read that there, and call the appropriate model to update the Database, but it is not working. 

Here is the relevant code:

The form submit buttons (in the view):

```
<div class="form-group">
    <div class="col-sm-5 col-sm-offset-7">
        <input id="type" style='font-size:18px; margin-left: 35px; margin-top: 10px;' name="submit" type="submit" value="Edit Ticket" class="btn btn-lg btn-success">
    </div>
    <div class="col-sm-3 col-sm-offset-9">
        <input id="type" style='font-size:18px; margin-left: 35px; margin-top: -65px;' name="submit" type="submit" value="Delete Ticket" class="btn btn-lg btn-danger">
        </div>
</div>

```

The receiving controller:

```
public function editExistingTicket(){
    $this->load->model('tickets');
    $ticketId = $this->input->post('ticketId');

    if ($this->input->post('submit') == 'Edit Ticket') {
        $ticket = array(
                  'ticketId'    => $ticketId,
                  'category'    => $this->input->post('category'),
                  'headline'    => $this->input->post('headline'),
                  'description' => $this->input->post('description'),
                  'assigned'    => $this->input->post('assigned'),
                  'open'        => $this->input->post('status'),
                  'priority'    => $this->input->post('priority')
                );
        $edited = $this->tickets->editTicket($ticket);
    } 
    if($this->input->post('submit') == 'Delete Ticket') {
        $this->tickets->deleteTicketById($ticketId);
    }
}

```

The model:

```
public function editTicket($ticket)
{
    $q = $this->db->where('ticketId', $ticket['ticketId']);
    $q = $this->db->update('tickets', $ticket);
    $results = $this->db->affected_rows();
    return $results;
}

```

Am I missing something easy? Or is the strategy for doing this incorrect? 

Thanks for the help!!