topvader Posted July 11, 2012 Share Posted July 11, 2012 ok so i think the easiest thing for me to do is to explain my scenario in full first i have created an admin panel, that governs certain program features, everytime i create a certain feature i then want to add users to that feature So, my workflow goes as such: 1. Create-feature.php 1a) creates a row in the feature table 1b) creates an Enum("0","1") column in the user field with that feature name 2.)edit-feature.php (the problem step) 2a) print all the usernames in a table with a checkbox 2b) when updated all the users checked will change the ENUM Column from 0 to 1 The code for the edit-feature is: <form name="form1" action="" method="" //blah blah blah $feature = $_GET['featurename'];// $ch = "unchecked"; $sql3 = mysql_query(" SELECT * FROM user ") or die(mysql_error()); while($row = mysql_fetch_array($sql3)){ $un = $row['username']; $state = $row[$feature]; if ($state ==1){ $ch = "checked"; } $usertable =' <table width="100" border="1" cellspacing="0" cellpadding="0"> <tr> <td><input type="hidden" name="username" id="username" value="'.$un.'"/>' .$un. ' </td> </tr> <tr> <td> <input type="checkbox" name="adduser[]" id="adduser" value="yes" '.$ch.' /> <label for="adduser"></td> </tr> </table> ' ; echo $usertable; } ?> <input type="hidden" name="featurename" id="featurename" value="'.$feature.'"/> </form> I have the following questions: once i get this to post i know i need a foreach loop. but how will i tie it to my user table? is there a much easier way of doing this? please let me know thanks Quote Link to comment https://forums.phpfreaks.com/topic/265522-newbie-needs-help-adding-users-to-program-feature/ 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.