Solved

Select email address from drop-down box.

Posted on 2001-07-19
8
208 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
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.

 

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 100 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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

For those who don't know, Adobe Dreamweaver is a popular commercial web editor that enables you to design, build and manage complex websites. The editor is a WYSIWYG (What You See Is What You Get) web editor, which means that you can create your web…
Adobe Dreamweaver CS5 is a WYSIWYG web page editor that has advanced HTML, CSS, and Javascript rendering functionality and is probably the most well-known HTML editor available. Much of Dreamweaver's appeal centers around the Design View interfac…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

829 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