This topic is locked

autopopulate user email?

12/4/2006 5:37:45 PM
ASPRunnerPro General questions
S
SteveL author

Hi I was wondering how do I populate a certain field with the users email?

For example I have a field where I use Session("UserID") to autopopulate a field with the users log in name.
can I do something similar with their email? like Session("UserEmail")

J
Jane 12/5/2006

Steve,
you can do it using BeforeRegister event.

Here is a sample code:

Function BeforeRegister(dict)

str = "select * from UsersTable where UserName='"&Session("UserID")&"'"

Set rsTemp = server.CreateObject("ADODB.Recordset")

rsTemp.open str, dbConnection

Session("UserEmail") = rsTemp("EmailField")

rsTemp.Close : set rsTemp = nothing

BeforeRegister = True
End Function



where UsersTable is your actual table name, UserName and EmailField are your actual field names in the UsersTable.