Gustav Posted January 15, 2008 Share Posted January 15, 2008 Hi guys, I have a small problem, the thing is i whant to load a page which displays the available modules and if it is enabled or not from the database (by showing the checkbox marked). That part works, however when i whant to try to update these fields i have no clue on how to perform that, i´ve tried several things i´ve found on the net but not working. Im a bit of noob in php. The database consist of two rows, module_name and is_enabled. Where is enabled is only 1 or 0 dependingif it is enabled or not. <FORM action="index.php" method="post"> <?PHP $array_row = mysql_query("SELECT * FROM check_modules"); while($row = mysql_fetch_array($array_row)){ $module_name = $row["Module_name"]; $array_enabled = mysql_query("SELECT is_enabled FROM check_modules where Module_name='$module_name'"); $enabled = mysql_fetch_array($array_enabled); $db_box1 = $row["is_enabled"]; if($db_box1 == 1) {$set_checked = "CHECKED";} else{$set_checked = "";} print "<input type=\"checkbox\" NAME=\"check[]\" VALUE=\"$db_box1\" $set_checked/> $module_name <br>"; $set_checked = ""; } ?> <br> <input type="submit" name="submit" value="Submit" /> </FORM> Im stuck here i dont know how to check if the boxes are checked or not and when submit is pressed update the is_enabled field with either 1 or 0. With regards, Gustav Quote Link to comment https://forums.phpfreaks.com/topic/86117-update-checkboxes-value/ Share on other sites More sharing options...
timmah1 Posted January 15, 2008 Share Posted January 15, 2008 What does your 'index.php' have on it? Quote Link to comment https://forums.phpfreaks.com/topic/86117-update-checkboxes-value/#findComment-439974 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.