In this page, settings.php I have over 20 options that the user gets to modify. Right now it works like this: PHP: if ($first) { if($first != $user['field']){ if($first == 1){ $message .= "Enabled. "; $set = 1; }elseif($first == 2){ $message .= "Disabled. "; $set = 2; } $DB->query("UPDATE users SET field = '$set' WHERE id=$user[id]", __FILE__, __LINE__); } PHP: HTML: <input type="radio" name="first" value="1" <?php if($user['field'] == 1){ echo "checked=1"; }?> /> On <input type="radio" name="first" value="2" <?php if($user['field'] == 2){ echo "checked=1"; }?>/> Off PHP: That's just a tiny fracture of the code so you can get the general idea. The other options are analogous. I think it's kinda annoying to check if the new submitted option is different from what is already in the database, and if is, then it will change it. Is there a better way to do this?
You could use: http://php.net/manual/en/control-structures.switch.php Follow Example #1 switch structure