I guess I'm not seeing the problem.
But, in order to get the email addresses out of the users table, you'd have to make a call to the users table, and load the results of that call into a hash variable (pointer to a hash).
Then, you'd use that returned result $user->{'Email'} to generate the proper values, and pass the test.
When adding a record, the only data available is the information in the $links hash of hashes. You need to use that value, to do a lookup on the $users table, and find the corresponding value, then pass _that_ value to the email template.
You could try to use a "join" construct, and do it all on one lookup, but I don't think it would work given the current construct of the code.
The best way would just be to do a get_record for the matching "user" value, then add that hash to the passed hash values. (or, assign $user->{email} to $links->{$id->{email}} or whatever).
Make sense?
In order to _use_ the values, you have to do an explicit lookup of the value in the user table. Then, pass that value to the email routines.
This is why I'm not sure why you did it the way you did, and why in another message, I said doing all the checks up front was a better way around the gestalt of the problem.
To do this right, would require a logic change to the code, where when a link was submitted with a valid userID. Then, when the "link" was going to be validated, (or presented in the Admin) a "join" was made with the users table, so that the missing data was inserted into the Admin edit screen. Then, when the records were sent to be validated, _all_ the link+user data was available, but only the link data was inserted into the Links table -- the rest was just discarded.
See what I'm getting to? The user management features need to be integrated on the front end, so that they are available through the program, otherwise you are going to have to make odd database calls at various points in the code (very messy) -- when the _logical_ place was up front, when the record was initially presented for approval.
If I've still not hit the problem, I really don't see it. What I see as the problem is you have no "Contact_Email" in the "link" and you need to get it from the "users" table, which is keyed to the link (or vice versa) by the UserID. Logically "join" the tables in the begining of the 'validate' routines, and you'll have those variables available in all the subsequent calls.
http://www.postcards.com
FAQ: http://www.postcards.com/FAQ/LinkSQL/
But, in order to get the email addresses out of the users table, you'd have to make a call to the users table, and load the results of that call into a hash variable (pointer to a hash).
Then, you'd use that returned result $user->{'Email'} to generate the proper values, and pass the test.
When adding a record, the only data available is the information in the $links hash of hashes. You need to use that value, to do a lookup on the $users table, and find the corresponding value, then pass _that_ value to the email template.
You could try to use a "join" construct, and do it all on one lookup, but I don't think it would work given the current construct of the code.
The best way would just be to do a get_record for the matching "user" value, then add that hash to the passed hash values. (or, assign $user->{email} to $links->{$id->{email}} or whatever).
Make sense?
In order to _use_ the values, you have to do an explicit lookup of the value in the user table. Then, pass that value to the email routines.
This is why I'm not sure why you did it the way you did, and why in another message, I said doing all the checks up front was a better way around the gestalt of the problem.
To do this right, would require a logic change to the code, where when a link was submitted with a valid userID. Then, when the "link" was going to be validated, (or presented in the Admin) a "join" was made with the users table, so that the missing data was inserted into the Admin edit screen. Then, when the records were sent to be validated, _all_ the link+user data was available, but only the link data was inserted into the Links table -- the rest was just discarded.
See what I'm getting to? The user management features need to be integrated on the front end, so that they are available through the program, otherwise you are going to have to make odd database calls at various points in the code (very messy) -- when the _logical_ place was up front, when the record was initially presented for approval.
If I've still not hit the problem, I really don't see it. What I see as the problem is you have no "Contact_Email" in the "link" and you need to get it from the "users" table, which is keyed to the link (or vice versa) by the UserID. Logically "join" the tables in the begining of the 'validate' routines, and you'll have those variables available in all the subsequent calls.
http://www.postcards.com
FAQ: http://www.postcards.com/FAQ/LinkSQL/