?
Solved

Select email address from drop-down box.

Posted on 2001-07-19
8
Medium Priority
?
223 Views
Last Modified: 2010-04-07
I have a Contact Us form and would like to have the email sent to the person that is selected from a drop-down box.

Is there an easy way to do this??? Thanks
0
Comment
Question by:LTurk
  • 5
  • 3
8 Comments
 
LVL 3

Expert Comment

by:MHQ
ID: 6302457
Do you have a cgi or similar to handle to sendinbg of the e-mail or do you mean opening up the visitors mail-program with the correct adress?

/MHQ
0
 

Author Comment

by:LTurk
ID: 6302482
I created most of the site with DreamWeaver but I created the Contact Us Form with Front Page because it is so easy to do in Front Page.  Therefore I didn't have to bother with a cgi.

0
 
LVL 3

Expert Comment

by:MHQ
ID: 6302497
You still need a serverside function to send the mail unless you use the visitors own mailing program. I guess this is what you are planning on doing so let me work out a solution for you.

/MHQ
0
Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

 

Author Comment

by:LTurk
ID: 6302579
I'm still a beginner at web pages so I'm not sure what I need or use. But there's hope - I am signing up for some classes next week:) But in front page all you do is create the form,go into the form properties, and type in the email address of where you want the info to be emailed to. I think i read somewhere that it does create a cgi for you but it is hidden and not something you can edit.
0
 
LVL 3

Expert Comment

by:MHQ
ID: 6302600
This should do it for you!

<script>
function mail(tt)
{
if (tt.form.myselect.value!="") {
tt.form.action="mailto:"+tt.form.myselect.value+"?subject="+tt.form.mysubject.value+"&body="+tt.form.themessage.value+"&";
tt.form.submit();
}
 else {
alert("You must choose a recipient!");
}
return false;
}
</script>
<form action="mailto:BobA@yy.com" name=myform>
Recipient:<br>
<select name=myselect>
<option value="">Select a person
<option value=BobA@yy.com>Bob A
<option value=BobB@yy.com>Bob B
<option value=BobC@yy.com>Bob C
<option value=BobD@yy.com>Bob D
</select>
<br>
Subject:<br>
<input type=text name=mysubject>
<br>
Message:<br>
<textarea name=themessage>
Type your message here
</textarea>
<br>
<input type=button value=Send email onclick=mail(this);>
</form>

Regards,
MHQ
0
 

Author Comment

by:LTurk
ID: 6302691
Does all that go into the Submit Button?
0
 
LVL 3

Accepted Solution

by:
MHQ earned 400 total points
ID: 6302729
Copy and paste the code below into the code of new document.

As you can see, I have removed the submit button and andded a regular button instead which calls the function that constructs the message and sends it.

I don't know how used you are to working directly with the code of HTML and javascript, if you need more explanation, just say so.

<html>
<head>
<script>
function mail(tt)
{
if (tt.form.myselect.value!="") {
tt.form.action="mailto:"+tt.form.myselect.value+"?subject="+tt.form.mysubject.value+"&body="+tt.form.themessage.value+"&";
tt.form.submit();
}
else {
alert("You must choose a recipient!");
}
return false;
}
</script>
</head>
<body>
<form action="mailto:BobA@yy.com" name=myform>
Recipient:<br>
<select name=myselect>
<option value="">Select a person
<option value=BobA@yy.com>Bob A
<option value=BobB@yy.com>Bob B
<option value=BobC@yy.com>Bob C
<option value=BobD@yy.com>Bob D
</select>
<br>
Subject:<br>
<input type=text name=mysubject>
<br>
Message:<br>
<textarea name=themessage>
Type your message here
</textarea>
<br>
<input type=button value=Send email onclick=mail(this);>
</form>
</body>
</html>

Regards,
MHQ
0
 
LVL 3

Expert Comment

by:MHQ
ID: 6309332
Glad it worked as you wanted! =)
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I still run into .cgi files every now and then. In some instances, I actually prefer the simplicity of a .cgi script to other options. Since I use DreamWeaver extensively, what I needed was a way to open .cgi scripts in Dreamweaver. And I wanted to …
This article is very specific and is only intended to help if you are installing Dreamweaver 8 in a Windows 7 environment with Office 2007 installed.   I'm not sure why Microsoft tends to release OS' that should not be released but they do.  Windows…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question