打开-关闭复选框按钮html中的iphone

打开-关闭复选框按钮html中的iphone,html,Html,如果复选框已选中,如何获取值Y;如果未选中,如何获取值N。我试过: <div class="onoffswitch"> <input type="checkbox" name="is_admin" class="onoffswitch-checkbox" value="Y" id="is_admin" checked> <input type="checkbox" name="is_a

如果复选框已选中,如何获取值Y;如果未选中,如何获取值N。我试过:

 <div class="onoffswitch">
                    <input type="checkbox" name="is_admin" class="onoffswitch-checkbox" value="Y" id="is_admin" checked>
                    <input type="checkbox" name="is_admin" class="onoffswitch-checkbox" value="N" id="is_admin">
                    <label class="onoffswitch-label" for="is_admin">
                        <span class="onoffswitch-inner"></span>
                        <span class="onoffswitch-switch"></span>
                    </label>
                </div>

不确定您在问什么,您有两个复选框,一个是
Y
作为值,另一个是
N
。所以只需选中其中一个?我从这个复选框中获取值,我想将这个值插入数据库:Y或NSo,应该将其放入数据库的整个代码在哪里?如果不选中复选框,该值将不会发送,因此
$\u POST['is_admin']
将为空。
 public function insertUser()
{
    $name = $this->input->post('name');
    $surname = $this->input->post('surname');
    $company = $this->input->post('company');
    $login = $this->input->post('login');
    $password = $this->input->post('password');
    $is_admin = $this->input->post('is_admin');
    $is_verificator = $this->input->post('is_verificator');
    $user = new user_m();
    $result = $user->user_m->validateUser($name, $surname, $company, $login, $password, $is_admin, $is_verificator);
    if(!$result)
    {
        $msg = '';
    }
    else
    {
        redirect(base_url().'administration/show/add_user');
    }
}
$is_admin = $this->input->post('is_admin') ? 'Y' : 'N';