Ok, It has been one of those days. Here is my bump in the road.
I have an add user form for the administrator. The administrator enters name, password and then selects access level from a dropdown. When the data is posted I take the administrator to a page where all users can be viewed. I then allow the administrator to select a user in the list that they would like to edit. The administrator is taken back to the add user form, but the form is filled in with the data of the user they wish to edit.
Problem..
My access level selection in a dropdown list. When the administrator wants to edit a user and the data is filled in the form, I can not figure out how to select the correct option from the dropdown. Any help will be nice.
[php]
function useradd() {
if ($_GET[option] == "edit") {
$nuser = getUser($_SESSION[nuser]);
}
print <<<PAGE
<div>
<form name="userForm" action="users.php" method="post">
<fieldset>
<legend>Add User</legend>
<p>
<label for="name">*User Name</label><input type="text" id="name" name="name" value="$nuser[name]" />
</p>
<p>
<label for="password">*Password</label><input type="password" id="password" name="password" value="" />
</p>
<p>
<label for="access">Access Level</label>
//This is where I need help selecting read only or administrator
<select id="access" name="access">
<option value="2">Read Only Access</option>
<option value="1">Administrator</option>
</select>
</p>
<p>
<input type="submit" name="aSubmit" value="Submit" onclick="if (userCheck() == false) return false;"/>
<input type="reset" />
<input type="button" onclick="location.href='users.php'" value="Back" />
</p>
</fieldset>
</form>
</div>
PAGE;
}
[/php]
The $nuser array will contain name, password, and accesslevel.
Thanks