Viewing 3 replies - 1 through 3 (of 3 total)
  • You’d need to store the email addresses somewhere in the back end or the code, and use your code to determine which one/ones to send to when the form is submitted.

    That is a pretty vague answer, and that’s becuase you’ve asked a pretty vague question. It’s hard ot give any sort of real coding advice unless we know how you’re trying to work things already.

    Thread Starter dieMelone

    (@diemelone)

    How more specific do you need it?
    My plan is to have a form that lets me switch recipients with a menu (dropdown, radio button, … ) so the user doesn’t have to bother searching for the right adresses. The rest of the form should be just basic stuff.

    How and where would I have to store the adresses?

    Thanks

    Normally you’d set up your own admin page, or you can put in on the admin page of some other section in your site. The Settings API can help with that.

    Then when your form is submitted you can use the values from that (assuming that you’re getting the values through POST here, of course).

    if ($_POST ['form_setting'] == 'option_a') {
        $recipients = get_option ('option_a_emails');
    }
    else {
        $recipients = get_option ('option_b_emails');
    }

    That’s a very braod overview of how you could possibly do it.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘if conditions’ is closed to new replies.