If all else fails:
Create an
ID field (if you haven't already) and set
$db_key to
ID eg:
$db_key = 'ID'; (nothing fancy just yet)
Then, create your forms as usual, but make the ID key a hidden field, so people can't mess with it.
eg:
<input type="hidden" name="ID" value="$rec{'ID'}"> Again, nothing to fancy yet, this is probobly how your database is already set up.
Now, open up
db.cgi and in the sub-routine
add_record, make the following
red change to the
green portion of code:
my ($output, $status, $counter);
# Set the userid to the logged in user.
($auth_user_field >= 0) and ($in{$db_cols[$auth_user_field]} = $db_userid);
$in{'ID'} = $in{'Year'} . $in{'Church'};
$in{'ID'} =~ s/ //g;
# First we validate the record to make sure the addition is ok.
$status = &validate_record; What we have now done is taken the Church and Year field and joined them together to form an ID. This will only happen at the add stage, the joined ID will be pulled out of the record for modifying from then on. The second line of red code is merely throwing out any spaces that may turn up.
You will need to turn of key tracking, and you may want to concider also appending a random number to the ID. In the very off chance that an entry has the same Church/Year, they will be forced to enter one of the fields differently.
Good luck!
- Mark
Astro-Boy!!
http://www.zip.com.au/~astroboy/