问题描述:

I'm really confused and I don't know why I've forgotten the way of doing this.

I want to store a checkbox value in the database when it's checked and unchecked. For example, store 0 when it's unchecked and 1 when it's checked.

This a piece of my code:

$course_Notifier = array('name' => 'course_Notifier', 'value' => set_checkbox(course_Notifier, 1);

echo form_checkbox($course_Notifier);

I know that it's really easy, But I completely have forgotten the way of doing it.

网友答案:

Here's the code that would help. Try this out

$course_Notifier = array('name' => 'course_Notifier', 'value' => set_checkbox(course_Notifier, 1); 

echo form_hidden('course_Notifier', 0);
echo form_checkbox($course_Notifier);
相关阅读:
Top