Solved

passing value to formmail

Posted on 2009-07-02
4
225 Views
Last Modified: 2012-05-07
Hi,

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="luisnava-gomez1@thisplace.com">Luisville, TEST</option>
<option value="luisnava-gomez2@thisplace.com">Jillville, TEST</option>
<option value="luisnava-gomez3@thisplace.com">Heatherton, TEST</option>
</select>

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.

0
Comment
Question by:itortu
  • 2
  • 2
4 Comments
 
LVL 5

Expert Comment

by:8riaN
ID: 24765091
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.

8riaN
<option value="Luisville, TEST <luisnava-gomez1@thisplace.com>">Luisville, TEST</option>

<option value="Jillville, TEST <luisnava-gomez2@thisplace.com>">Jillville, TEST</option>

<option value="Heatherton, TEST <luisnava-gomez3@thisplace.com>">Heatherton, TEST</option>

Open in new window

0
 

Author Comment

by:itortu
ID: 24765232
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
0
 
LVL 5

Accepted Solution

by:
8riaN earned 250 total points
ID: 24765367
Then you'd need javascript to populate another hidden field.  Like this:


<head>

...

<script type="text/javascript">

function formSubmitted(thisForm) {

   with(thisForm) {

      nameSelected.value = recipient.options[recipient.selectedIndex].text;

   }

}

</script>

</head>
 

...
 

<form action="formmal.pl" method="post" onSubmit="formSubmitted(this) ;">

<input type="hidden" name="nameSelected">

...

</form>

Open in new window

0
 

Author Closing Comment

by:itortu
ID: 31599251
Thank you, that was exactly what I was looking for.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

919 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now