It's not hard at all to have fields that only the admin can see. The best way to explain it, though, is to give you a little example. Here's the basic form:
Code:
print qq|
<table>
<tr><td>ID:</td>
<td><input type="text" name="ID" value="$rec{'ID'}"></td>
<tr><td>Name:</td>
<td><input type="text" name="Name" value="$rec{'Name'}"></td>
<tr><td>Address:</td>
<td><input type="text" name="Address" value="$rec{'Address'}"></td>
<tr><td>City:</td>
<td><input type="text" name="City" value="$rec{'City'}"></td>
</table>|;
I want to make the ID field editable by the admin only, so I make the following changes:
Code:
print qq|
<table>
|;
if ($per_admin) {
print qq| <tr><td>ID:</td>
<td><input type="text" name="ID" value="$rec{'ID'}"></td>
|;
}
else {
print qq|<input type="hidden" name="ID" value="$rec{'ID'}">|;
}
print qq| <tr><td>Name:</td>
<td><input type="text" name="Name" value="$rec{'Name'}"></td>
<tr><td>Address:</td>
<td><input type="text" name="Address" value="$rec{'Address'}"></td>
<tr><td>City:</td>
<td><input type="text" name="City" value="$rec{'City'}"></td>
</table>|;
You need to make a hidden field for non-admin users so that the data won't be lost if they modify the record. (If only admins can modify, you can leave out the "else" part.)
The same goes for the display of the record:
Code:
print qq|
<table>
<tr><td>ID:</td>
<td>$rec{'ID'}</td>
<tr><td>Name:</td>
<td>$rec{'Name'}</td>
<tr><td>Address:</td>
<td>$rec{'Address'}</td>
<tr><td>City:</td>
<td>$rec{'City'}</td>
</table>|;
becomes
Code:
print qq|
<table>
|;
if ($per_admin) {
print qq| <tr><td>ID:</td>
<td>$rec{'ID'}</td>
|;
}
print qq| <tr><td>Name:</td>
<td>$rec{'Name'}</td>
<tr><td>Address:</td>
<td>$rec{'Address'}</td>
<tr><td>City:</td>
<td>$rec{'City'}</td>
</table>|;
Since there's no form involved, you don't have to make any allowances for non-admin users in the display.
Does this help?
------------------
JPD
[This message has been edited by JPDeni (edited May 24, 1999).]