Email problem

K

Kari Setälä

I'm using ASP VBScript. I have a feedback form that should do two things:
insert the contents into a database and send the contents as email. The
address it would be sent to varies - users select the company they want to
send the feedback to from a menubox. The problem is that I can't just type
the email addresses as "option values" since I need to save the company name
to a database. I don't want to save the email addresses. This would
otherwise solve my problem.

I know how to update the database, use CDONTS etc., but I need to find a way
to somehow change the email address the email is sent to depending on the
selection of the menu.

How about using 'OnChange' behavior for the menu and creating a script
function (called SaveEmail) which inserts the email address into a session
variable, depending on the selection? I've tried it, but I receive an error:
"SaveEmail is not defined".

For example:

<script runat="server" language="javascript">
function SaveEmail() {
if (document.form1.Company.value == "My Company")
{ Session("email")[email protected]";
}

etc...
}</script>
 
A

Adrian Forbes - MVP

If you don't mind the e-mail addresses being on the client
then make the VALUE of the combo box for the company name
contain the E-mail also;

<select name=cboCompany....>
<option value="(e-mail address removed):Company A">Company A
<option value="(e-mail address removed):Company B">Company B

In your ASP do something like

' Split the value into an array using : as a delimiter
aCompany = SPlit(Request("cboCompany"), ":")
' EMail is in first element
' Name is in second
aEmail = aCompany(0)
aName = aCompany(1)

That way the user only sees "Compny A" in the combo box,
but what you submit to ASP is both the name and the e-mail
address.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
474,082
Messages
2,570,589
Members
47,212
Latest member
JaydenBail

Latest Threads

Top