The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
multiple select box or checkboxes in the registration form
#7
Yeah...so there are a few ways to do that with foreach loops and stuff like that, but I would manually update the entire row of checkboxes at every update of the user info. I think it's simpler.

I would do something like (assuming you have your db showing 1 for checked and 0 for unchecked)
Code:
$over_18 = Input::get('over_18');
Code:
if ($over_18 === 1) {
Code:
$over_18 = "1";
Code:
} else {
Code:
$over_18 = "0";
Code:
}
Or something like this. This way, you are checking the value of over_18 every time they are updating.

I'm guessing the other part you want to know how to do is to pre-check the boxes... that would be...
Code:
<input type='checkbox' name='over_18' id='over_18' value='1' <?php if ($user->data()->over_18 == '1')
Code:
echo "checked='checked'"; ?>> Are you over 18?

Note that the last 2 lines are all technically one line
  Reply


Messages In This Thread
multiple select box or checkboxes in the registration form - by mudmin - 11-14-2016, 04:37 PM

Forum Jump:


Users browsing this thread: 8 Guest(s)