473,818 Members | 1,877 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Drop down selection to set e-mail recipient of form

1 New Member
Hi,

bit baffled with this but very newbie with php. I have an html form that works fine with the cgi script that our institution has provided for me to work with. What I would like however is the recipent of the form to be set by the users selection from a drop down list (if they choose "A" it goes to Mr. Brown, if they choose "B" it goes to Mrs. Smith etc).

I understand that I may need a switch statement that would set a variable depending on the selection made from the drop downlist but not sure how this would look or how the variable could then be used to set the e-mail address used which is currently set in a hidden field in the html code:

Expand|Select|Wrap|Line Numbers
  1.  
  2. <input name="recipient" type="hidden" id="recipient" value="me@here.com" />
  3.  
  4.  
Pretty sure this is fairly standard stuff but not really getting anywhere with it. Any clues?

Thanks a lot,

Si
Jan 25 '08 #1
1 2785
harshmaul
490 Recognized Expert Contributor
You want to use a select.


in the form

<select name="emails">
<option value="MrJonesa thotmail.com">
MrJonesathotmai l.com</option>
<option value="MrSmitha thotmail.com">
MrSmithathotmai l.com</option>
</select>


------------------------

in the php code that recieves this....

if (IsSet($_POST['emails']){
$Emails = $_POST['emails'];
//the variable $Emails now contains the email

}
Jan 25 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

8
1673
by: JayB | last post by:
I am creating an online survey for one of our grants and one of the items to be answered is county (U.S.). The county is to be in a drop-down menu to prevent typos and counties from other states by mistake. I'm doing server-side validation (many of our users have disabled JavaScript) and need to retain the user's selection if they need to revisit the page to make corrections. In the past I'd declare variables for each choice in the...
11
2504
by: Dan | last post by:
Hello all, I am getting records from a db and displaying the records to the user through a drop down menu in an asp page. Each record has 6 fields and I need to display them all to the user in the drop down. The problem is that the fields contain values of all different lengths and the columns are not aligned.
5
6531
by: SirPoonga | last post by:
I think I'd have to do a combination of ASP and javascript to do this. What I want to do fill the first drop down box with values from a database query. Then based off that selection fill in the values of another drop down. Let's use the car industry as an example. Lets say I am storing in a database the data and relationships between car make, car type, and car model. So the first drop down box would like all makes. Upon selecting...
2
9478
by: kmnotes04 | last post by:
Is it possible to link one drop-down box to another? For example, if a name is chosen from a drop-down list, can another drop-down list then automatically display the person's office as a result of the choice made in the first drop-down list? If so, how can that be done? I am working with 'Teach Yourself Microsoft Access' and I didn't see it discussed in that book (if it's even possible to do). Or would I just have to create linked tables...
4
1198
by: IGotYourDotNet | last post by:
I have 2 drop downs on my screen the second one is displayed and populated based on the selection of the first drop down. The problem i'm having is that when a user selects something it keeps going back to the first item in the list - in this case is Select Car. How can I keep the users selection displayed in the drop down?
0
2109
by: TD | last post by:
I have a combobox that is sometimes slow to drop down when clicked on. If you select an item in the list that is near the top of the list then the next time you click on the combobox it drops down fast for you to make another selection. If you click on an item from the list that is way down the list then the next time you click on the combobox it takes several seconds for it to drop down so you can make another selection The combobox is...
4
3666
by: deepee | last post by:
I have a drop down box in HTML using SELECT and OPTION tags: <select title="Choose a number" onchange="obscure()" name="Digit1" ID="Digit1"> <OPTION VALUE="">&nbsp;</OPTION> <OPTION VALUE="0">&nbsp;0</OPTION> <OPTION VALUE="1">&nbsp;1</OPTION> <OPTION VALUE="2">&nbsp;2</OPTION> <OPTION VALUE="3">&nbsp;3</OPTION> </select>
2
3069
by: ponyeyes | last post by:
Hi There, I am a bit of a newbie to PHP programming and I would like to know how I can place a selected drop down option into a PHP variable and then produce an sql query which incorporates this variable. I have created a dynamic drop down menu that populates itself with data from a MySQL table. I now want it to populate a second drop-down menu with relevant options from my database, based upon a query using a variable. For example........
0
1531
by: Geary | last post by:
I have a drop down list on an asp.net 2 page that is bound to a table. By default it displays the first item as the selected item. But I want to make sure that the user must change the selection. I am using the change-selection event to trigger so other code. If the user is satisfied with the default this other code won't run. So I am adding an additional .item.add("(None)") after the .databind() to add a (None) selection to the list....
3
2555
by: amcoldspy | last post by:
Hi, am trying to create dynamic drop down boxes.. there are 3 drop down boxes. The second drop down box elements are to be update based on the selection made in the first drop down box (selecting an element on the first drop down box calls a getData.jsp file which returns the result.) the third drop down box elements are to be update based on the selection made in the second drop down box (selecting an element on the second drop down...
0
9618
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10153
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7696
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6909
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5576
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5715
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4366
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3903
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3039
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.