如果选中该复选框,如何获得值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');
}
}
答案 0 :(得分:0)
$is_admin = $this->input->post('is_admin') ? 'Y' : 'N';