Welcome Guest, Not a member yet? Register   Sign In
Codeigniter passing checkbox array values to mysql database
#3

[eluser]CroNiX[/eluser]
[quote author="comyou" date="1393375720"]I haven't tested it but I'm sure you should be checking if it's checked or not.

Try something like:
Code:
if(isset($this->input->post('fanta'))) {
                $data['fanta'] = '1';
} else {
                $data['fanta'] = '0';
};

That should check if the checkbox is checked and return '1' is so, that way any value in your Database other than '1' is a false.

Apologies if it doesn't work.[/quote]
No, that actually won't work. Since input::post() will return boolean FALSE if the field was not in $_POST, or returns the value if it does, it will always be "set" so isset() test will always be true.


Messages In This Thread
Codeigniter passing checkbox array values to mysql database - by El Forum - 02-25-2014, 08:21 PM



Theme © iAndrew 2016 - Forum software by © MyBB