Hello! I have been searching for a good solution all morning but can't seem to get one!

I'm trying to create a form that sends to a different set of email addresses based on what is selected in a drop down menu. While I can make this happen, I need to insert the text from that drop down into a title - not the value.

I don't want to create two identical drop down menus - does anyone know how I can pull the text from a drop down menu that has a value in PHP? Thanks!!

Member Avatar for diafol

Why don't you set the value to the email address? SHow your code and where it's all going pear-shaped.

Well if you want to get the text of dropdown not the value, you can use this:

var text = $("#dropdown").text();

Note: Include Jquery script to use this code!

Member Avatar for diafol

The js will fail is js not enabled. You still have to 'send' the js value, e.g. apply it to a hidden form field. Safer to use plain html and apply the proper value.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.