?
Solved

Select email address from drop-down box.

Posted on 2001-07-19
8
Medium Priority
?
220 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

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…
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 …
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

650 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