LTurk
asked on
Select email address from drop-down box.
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
Is there an easy way to do this??? Thanks
ASKER
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.
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
/MHQ
ASKER
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.
This should do it for you!
<script>
function mail(tt)
{
if (tt.form.myselect.value!=" ") {
tt.form.action="mailto:"+t t.form.mys elect.valu e+"?subjec t="+tt.for m.mysubjec t.value+"& body="+tt. form.theme ssage.valu e+"&";
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
<script>
function mail(tt)
{
if (tt.form.myselect.value!="
tt.form.action="mailto:"+t
tt.form.submit();
}
else {
alert("You must choose a recipient!");
}
return false;
}
</script>
<form action="mailto:BobA@yy.com
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
ASKER
Does all that go into the Submit Button?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Glad it worked as you wanted! =)
/MHQ