Okay how I have things set up is that each student has his own table in the database. I pull information from each table and list everything. I want to be able to select lock or unlock from the drop down menu on multiple rows(multiple students) and update each field in the specific table corresponding to the student. Thanks in advance
<?php
if(isset($_POST["updatelock"]))
{
$lockwho=$_POST["lockwho"];
$locknumber=$_POST["locknumber"];
$unlockandlock = $_POST["unlockandlock"];
$lockupdate = mysql_query("update $lockwho set teacher_lock='$unlockandlock' where number='$locknumber'");
}
?>
<html>
<body>
$userrecall=mysql_query("select student from users ");
$x=1;
while(list($student)=mysql_fetch_array($userrecall))
{
$sql[$x]=mysql_query("select * from $student where number='$assign'");
if(mysql_num_rows($sql[$x] ) >= 1)
{
$who[$x]=$student;
}
$x++;
}
?>
<table border=1px;>
<th>Student</th>
<th>Filename</th>
<th>Type</th>
<th>Size (b)</th>
<th>Lock/Unlock</th>
<th>Grade</th>
<th>Time Uploaded</th>
<th>Update</th>
<form method="post">
<?php
for($i=1; $i!=$x; $i++)
{
while(list($id, $filename, $type, $size, $content, $description, $number, $comments, $teacher_lock, $grade, $upload_time)=mysql_fetch_array($sql[$i]))
{?>
<tr>
<td><?php echo $who[$i] ?></td>
<td> <a href="newadmin.php?what=assignments&assignment=<?php echo $assign ?>&student=<?php echo $who[$i] ?>&id=<?php echo $id ?>"><?php echo $filename ?> </a></td>
<td><?php echo $type ?> </td>
<td><?php echo $size ?> </td>
<td>
<select name="unlockandlock">
<?php
if($teacher_lock == "locked")
{?>
<option value="lock">Locked</option>
<option value="unlocked">Unlocked</option>
<?php }
if($teacher_lock =="unlocked")
{?>
<option value="unlocked">Unlocked</option>
<option value="locked">Locked</option>
<?php } ?>
</select>
</td>
<td><?php echo $grade ?> </td>
<td><?php echo $upload_time ?> </td>
<td><input type="submit" name="updatelock" value="Update" /></td>
</tr>
<input type="hidden" value="<?php echo $number ?>" name="locknumber" />
<input type="hidden" value="<?php echo $id ?>" name="lockid" />
<input type="hidden" value="<?php echo $who[$i] ?>" name="lockwho" />
<?php
}
}
?>
</form>
</table>
</body>
</html>