Hello, I am currently writing a script whereby an array of checkboxes are displayed using:
<?
while($i = mysqli_fetch_array($get_perms)){
$pname = $i[pname];
$id = $i[id];
?>
<div>
<input type="checkbox" tabindex="1" name="<? echo("$id");?>" value="1" <? if($permissionid[$id] == '1') {echo ' checked="checked" ';}?> /><?echo(" $pname");?>
</div>
<? } ?>
However, I also have another part doing a similar thing, but for Sget_perms
is a different sql to gain different data.
Now, obviously, when it comes to posting back the data to the form/script, there's going to be a problem between distinguishing the two databits in the form.
This is the SQL to update the data given from form:
$insert = mysql_query("UPDATE `perms` SET
`title`='$_POST[title]',
`1` ='$_POST[1]',
`2` ='$_POST[2]',
`3` ='$_POST[3]',
`4` ='$_POST[4]',
`5` ='$_POST[5]',
`user` ='$_POST[username]'
WHERE `userid` = '$valued_user_show[id]'
")
So how on earth do I correctly distinguish between the two, and there be able to correctly enter the SQL?
The schema of the table is basically:
7 columns, userid, user, 1, 2, 3, 4 ,6 userid is the userid of the user who has been posted to script before form. user is the name. The numbers are the permission numbers.
$get_perm is the sql to load the current information about the user from the table in an array.