Welcome Guest, Not a member yet? Register   Sign In
Not getting the value from the on/off switch checkbox
#3

[eluser]jonez[/eluser]
As ivantcholakov said the key will only exist if it was checked. When you save the form data to your database check if the key was submitted, if it was set it to 'on' if the key was omitted set it to 'off'.

Code:
$data = $this->input->post( );

// change 1 to your 'on' value
// change 0 to your 'off' value
$data[ 'mycheckbox' ] = ( array_key_exists( 'mycheckbox', $data ) ) ? 1 : 0;


Messages In This Thread
Not getting the value from the on/off switch checkbox - by El Forum - 03-31-2014, 12:03 AM
Not getting the value from the on/off switch checkbox - by El Forum - 03-31-2014, 02:18 AM
Not getting the value from the on/off switch checkbox - by El Forum - 03-31-2014, 04:38 AM
Not getting the value from the on/off switch checkbox - by El Forum - 03-31-2014, 11:50 PM
Not getting the value from the on/off switch checkbox - by El Forum - 04-01-2014, 12:00 AM
Not getting the value from the on/off switch checkbox - by El Forum - 04-01-2014, 12:42 AM
Not getting the value from the on/off switch checkbox - by El Forum - 04-03-2014, 11:31 PM
Not getting the value from the on/off switch checkbox - by El Forum - 04-04-2014, 02:03 PM



Theme © iAndrew 2016 - Forum software by © MyBB