打开关闭复选框按钮iphone在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_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>

但是我不能选择开,关。

 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';

最新更新