Q:

how to save data from Bootstrap Modal using Codeigniter?

I am trying to save data inserted from a modal. Now i have a view called users where i show the list of users.now if admin clicks on add more users it opens a bootstap modal where i have a field called no of users requested. So whatever value the admin fills that must be save into database. I am confused on how to save this.

Edited...................................................

After reseller logs in he can request more users to admin so i created that modal to request the users required so i want to store the number of users required by that reseller along with his/her key 
My Controller is :
public function index ()
{
     $usertype=$this->session->userdata('usertype');
    if($usertype ==="reseller")
    {
    $key= $this->session->userdata('key');

    $this->db->where("key",$this->session->userdata('key'));        
    $this->data['users'] = $this->user_m->get();

    // Load view
    $this->data['subview'] = 'reseller/user/index';
    $this->load->view('reseller/_layout_main', $this->data);
}
else
{
    $this->load->view('permission');

}

}

My view Is :
    <a href="#" class="btn btn-success" data-toggle="modal" data-target="#myModal">Request More Users</a>

    <div id="myModal" class="modal fade" role="dialog">
      <div class="modal-dialog">

        <!-- Modal content-->
        <div class="modal-content">
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal">&times;</button>
            <h4 class="modal-title">Add the number of users you want</h4>
          </div>
          <div class="modal-body">
            <form id="loginForm" method="post" class="form-horizontal">
                        <div class="form-group">
                            <label class="col-xs-3 control-label">Number Of Users</label>
                            <div class="col-xs-5">
                                <input type="text" class="form-control" name="username" id="spinnerInput" />
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-xs-3 control-label">Password</label>
                            <div class="col-xs-5">
                                <input type="password" class="form-control" name="password" />
                            </div>
                        </div>

                        <div class="form-group">
                            <div class="col-xs-5 col-xs-offset-3">
                                <button type="submit" class="btn btn-primary">Submit</button>

                            </div>
                        </div>
                    </form>
          </div>
          <div class="modal-footer">
            <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
          </div>
        </div>

      </div>
    </div>

A:

Your question unclear but will give it ago. On your form you need to have form action if you do not have it then will not work. make sure also url helper is auto loaded.
Docs http://www.codeigniter.com/docs
Also would look into codeigniter form validation http://www.codeigniter.com/user_guide/libraries/form_validation.html
And form helper 
http://www.codeigniter.com/user_guide/helpers/form_helper.html
<form action="<?php echo base_url('controller-name/function');?>" method="post" method="post">
You may need to use index.php in base_url();
<form action="<?php echo base_url('index.php/controller-name/function');?>">
View
<a href="#" class="btn btn-success" data-toggle="modal" data-target="#myModal">Request More Users</a>

<div id="myModal" class="modal fade" role="dialog">
<div class="modal-dialog">

<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Add the number of users you want</h4>
</div>
<div class="modal-body">
<form id="loginForm" method="post" class="form-horizontal" action="<?php echo base_url('controller-name/request');?>">

<div class="form-group">
<label class="col-xs-3 control-label">Number Of Users</label>
<div class="col-xs-5">
<input type="text" class="form-control" name="username" id="spinnerInput" />
</div>
</div>

<div class="form-group">
<label class="col-xs-3 control-label">Password</label>
<div class="col-xs-5">
<input type="password" class="form-control" name="password" />
</div>
</div>

<div class="form-group">
<div class="col-xs-5 col-xs-offset-3">
<button type="submit" class="btn btn-primary">Submit</button>
</div>

</div>
</form>
</div>

Model
class User_m extend CI_Model {

function request_user() {
    $data = array(
        'key' => $this->session->userdata('key'),
        'total_user' => $this->get_total(), // create a column in table
        'username' => $this->input->post('username')
    );

    $this->db->insert('table', $data);
}

function request_update_user() {
    $data = array(
        'total_user' => $this->get_total() // create a column in table
        'username' => $this->input->post('username')
    );
    $this->db->where('key', $this->session->userdata('key'));
    $this->db->update('table', $data);
}

function get() {
    $this->db->where('key', $this->session->userdata('key'));
    $query = $this->db->get('table');
    return $query->result_array();
}

function get_total() {
   $this->db->where('key', $this->session->userdata('key'));
   $query = $this->db->get('table');
   return $query->num_rows();
}

}

Controller 
class Reseller extends CI_Controller {

public function __construct() {
    parent::__construct();
    $this->load->model('user_m');
}

public function index () {

    $usertype = $this->session->userdata('usertype');

    if($usertype == "reseller") {

    $this->data['users'] = $this->user_m->get();

    // Load view
    $this->data['subview'] = 'reseller/user/index';
    $this->load->view('reseller/_layout_main', $this->data);

} else {

    $this->load->view('permission');
}

}

public function request() {
    $this->load->library('form_validation');

    $this->form_validation->set_rules('username', 'Username', 'required');

    if ($this->form_validation->run() == FALSE) {
        $this->load->view('modal_view');

    } else {
        $this->user_model->request_user();
        redirect('your_controller');
    }
}

}

