The userid is the field which designates who owns the record.
When you use $db_uid is also contains the logged in user's authentication. This is used in links and is a part of $db_script_link_url when a user is logged. This maintains their login status and displays menu options according to their permissions.
You can just make your Userid a hidden field in your html_record_form. Or add it under a section for admin only such as:
|;
if ($per_admin) { print qq|
<TR><TD><$font>User ID: </font></TD><TD><$font><input type="TEXT" NAME="Userid" VALUE="$rec{'Userid'}"></TD></TR>|;
}
else {
print qq| <TR><TD colspan=2><input type="hidden" NAME="Userid" VALUE="$rec{'Userid'}"></TD></TR> |;
}
print qq|
How can I get the userid to be displayed in the add form?
In db.cgi, sub get_defaults, after:
foreach $field (keys %db_defaults) {
$default{$field} = $db_defaults{$field};
add:
####### add userid in add form #####
($auth_user_field >=0) and ($db_defaults{$db_cols[$auth_user_field]} = $db_userid);
####### end change #######
If you don't want the userid automatically filled in if you are logged in as admin use the following instead:
####### add userid in add form unless admin ###
unless ($per_admin) {
($auth_user_field >=0) and ($db_defaults{$db_cols[$auth_user_field]} = $db_userid);
}
####### end change #######
This and many other tips and trick can be found in the FAQ noted below.
Unoffical DBMan FAQ
http://creativecomputingweb.com/dbman/index.shtml/