You could (my 2 cents

) leave the $x var out, it is no use
Code: Select all
<?
$pquery = "SELECT username from users WHERE groupname='$_SESSION[groupname]'";
$presult = mysql_query($pquery, $db_conn);
echo '<table><tr align="left" valign="top"><td class="main"><b>Job User(s) are for:</b><br />';
while ($prow = mysql_fetch_array($presult)){
echo '<input type="checkbox" name="username[]" value="'.$prow['username'].'">'.$prow['username'].'<br />';
}
echo '</td></tr></table>';
?>
Then you have to loop over the username posted var:
Code: Select all
<?
while(list(, $user) = each($_POST["username"])) {
// Do what is needed for each user here...
// like echo their names
echo $user."<br />";
}
?>
I've used the while, because, if you stick to your $x var, and the user selects the first and 3rd user you'll get an array as such:
$_POST["username"][0] = "first user's name";
$_POST["username"][2] = "3rd user's name";
So you can't really use a for() loop
naming the checkbox as username[] will result in php creating the "ordered" array for you ([0], [1],...)
Don't know if it was really what you were asking for, but in the meantime it's an answer
