Solved

passing value to formmail

Posted on 2009-07-02
4
228 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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.

Question has a verified solution.

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

Recently I have been answering a lot of questions like this in IT forums that I frequent. The question posed is usually something along the lines of "We have software X installed and need to uninstall it for reason Y" or some other variant of the sa…
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
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 and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

679 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