passing value to formmail


Recently I have been asked to make a modification to the html form that calls it.

I use the id "recipient" on a select menu and depending the value selected from the drop down list, a specific person receives an email, like this:

<select name="recipient" id="recipient">
<option value="">Luisville, TEST</option>
<option value="">Jillville, TEST</option>
<option value="">Heatherton, TEST</option>

my question is:

passing the email value according to the value selected is working for luis1, luis2, and luis3. How can I also pass the values that is actually selected by the user?
in this case: Luisville, TEST, Jillville, TEST, Heatherton, TEST

Thank you much for your help.

Who is Participating?
8riaNConnect With a Mentor Commented:
Then you'd need javascript to populate another hidden field.  Like this:

<script type="text/javascript">
function formSubmitted(thisForm) {
   with(thisForm) {
      nameSelected.value = recipient.options[recipient.selectedIndex].text;
<form action="" method="post" onSubmit="formSubmitted(this) ;">
<input type="hidden" name="nameSelected">

Open in new window

Hard to tell exactly what you are asking.

Do you mean you want the email address of the recipient to show the text "Luisville, Test" text in the "to" address of the resulting email? In that case, replace your options list with the one below. Otherwise, explain what you want in more detail, please.

<option value="Luisville, TEST <>">Luisville, TEST</option>
<option value="Jillville, TEST <>">Jillville, TEST</option>
<option value="Heatherton, TEST <>">Heatherton, TEST</option>

Open in new window

itortuAuthor Commented:
what i want is to be able to select "Luisville, TEST" and
then luisnava-gomez1 will receive the email and also the value "Luisville, TEST" in the email body.

if select "Jillville, TEST" then luisnava-gomez2 will receive the email and the value "Jillville, TEST" in the email body
itortuAuthor Commented:
Thank you, that was exactly what I was looking for.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.