Form email subject depending on button clicked

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I need to setup a feedback form, probably a PHP one, which will set the
subject of the email depending on which button is clicked. There are
numerous buttons, each associated with a product. eg Button for blue
widgets will set subject in email to "Blue widget enquiry"
Thanks for any help.

Re: Form email subject depending on button clicked

Quoted text here. Click to load it

I would strongly suggest that you save yourself the aggravation and simply
use a dropdown list (or radio buttons etc) to indicate the subject area, and
only have one button.

I assume you have a different page (or at least postback to the original
page) in order to generate the email? If you insist on having several
buttons you will need to use javascript to change the action attribute of
the form to once that contains a querystring to indicate the subject. And
alternative is to use javascript to populate a hidden Subject form field.
And a final alternative is to use javascript to manually post the form to
the processing page with a querystring added on. In each case, javascript is
the key, and therefore you might be better served posting the question on a
javascript-focused NG (eg comp.lang.javascript).

A quick (untested) example: <input id="sendemail" type="submit"

Site Timeline