checkbox always checked |
[eluser]ibnclaudius[/eluser]
input: Quote:<input id="input-remember" type="checkbox" checked="checked" name="remember" value="TRUE" /> controller: Code: $remember = $this->input->post('remember'); checking... Code: if ($remember === 'TRUE') {} But the condition is always running.
[eluser]Jan_1[/eluser]
yes as long as you write Code: checked=“checked” name=“remember” value=“TRUE” Maybe use a variable there? See http://ellislab.com/codeigniter/user-gui...elper.html
[eluser]ibnclaudius[/eluser]
Is the same thing... Code: $data = array(
[eluser]Jan_1[/eluser]
You are still not using a variable. Have a look in form_helper for set_value().
[eluser]ibnclaudius[/eluser]
I tried this: Code: <input id="input-remember" type="checkbox" checked="checked" name="remember" value="<?php echo set_value('remember', 'TRUE'); ?>" /> But after this line, nothing more is load.
[eluser]ibnclaudius[/eluser]
set_value is wrong, but also with this: Code: <input id="input-remember" type="checkbox" checked="checked" name="remember" value="TRUE" <?php echo set_checkbox('remember', 'TRUE'); ?> /> Everything after this line dont load...
[eluser]Jan_1[/eluser]
I think I missunderstood you and don't know your question!? Back to your first post: Maybe print out $this->input->post('remember');
[eluser]ibnclaudius[/eluser]
I got the problem. It was in the javascript. I was getting the .val() of the checkbox, that's why the condition was always true, now I'm using .is(':checked') Thanks ,all! |
Welcome Guest, Not a member yet? Register Sign In |