![]() |
Setting the default value of an input. - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Setting the default value of an input. (/showthread.php?tid=22919) |
Setting the default value of an input. - El Forum - 09-23-2009 [eluser]ElShotte[/eluser] I have 4 fields that need to have a default value of 0. Naturally, their value is set to set_value('blah'). So I was thinking, if statements like so: $field = 0; if (isset($this->input->post('field'))) { $ssincome = $this->input->post('field'); } and set the value of the input to $field, but then for some reason when I load the page, it looks as if the CSS is not loaded because it is completely lacking style. Any ideas? I've also checked this: if (isset(set_value('pension'))) { $pension = set_value('pension'); } But the truth is, what I really want to do is require only one of the 4 fields, so technically my method wouldn't be perfect cause the user could just leave the 4 zeros and the form would still go through = bad. Time to break out the CI manual again. Setting the default value of an input. - El Forum - 09-23-2009 [eluser]ElShotte[/eluser] Code: //--Form Validation - Retired--// In the controller of course. |