Little puzzled. Here is my html code. It currently defaults to the lowest access level as defined in the query.
<option value="<?php echo $row_rsUserType['AccessLevel']?>"<?php if (!(strcmp($row_rsUserType['AccessLevel'], $row_rsUserType['AccessLevel']))) {echo "selected=\"selected\"";} ?>><?php echo $row_rsUserType['UserType']?></option>
my php for the selection box is:
<?php
//connect to the database and define the recordsets for the dynamic drop down box and its limits
//usertype recordset
//allow only the system administrator to add users with same access level, all other AccessLevels add user below
if ($_SESSION['loginAccessLevel'] == 1) {
$query_rsUserType = "SELECT UserType, AccessLevel FROM usertype WHERE AccessLevel >= ('{$_SESSION['loginAccessLevel']}') ORDER BY AccessLevel ASC";
} else {
$query_rsUserType = "SELECT UserType, AccessLevel FROM usertype WHERE AccessLevel >= ('{$_SESSION['loginAccessLevel']}'+1) ORDER BY AccessLevel ASC";
}
$rsUserType = mysql_query($query_rsUserType, $connMI) or die ('<p>Could not select the database because <b>' .mysql_error().'</b></p>');
$row_rsUserType = mysql_fetch_assoc($rsUserType);
$totalRows_rsUserType = mysql_num_rows($rsUserType);
?>
Unfortunately, I am currently at a loss here - newbie stuff, but I assume the change in the code will be in the bolded selection here:
<option value="<?php echo $row_rsUserType['AccessLevel']?>"<?php if (!(strcmp($row_rsUserType['AccessLevel'], $row_rsUserType['AccessLevel']))) {echo "selected=\"selected\"";} ?>><?php echo $row_rsUserType['UserType']?></option>