Jump to content

Sending form results to various email addresses based on dropdown


kokomo310

Recommended Posts

Hi.  I am creating a website that uses and online job application.  This company has a franchise, so we would like the results of the application to be emailed directly to the correct franchisee. 

 

If we have a dropdown that contains the various franchise locations, is there a way to specify when someone chooses "Washington State" that results are emailed to "washington@ourfranchise.com", "Colorado Springs, CO" would go to "colorado@ourfranchise.com"? 

 

Thank you for your help!  :)

Link to comment
Share on other sites

just make the value the email address

 

 

<select name="email">
  <option value="location$??.com">location1</option>
  <option value="locaion2@???.com">location2</option>
</select>

 

and in the script similar to the following use the link to get all the mail functions

 

<?php
$to      = $_POST['email'];
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "\r\n" .
    'Reply-To: webmaster@example.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
?> 

http://www.php.net/manual/en/function.mail.php

Link to comment
Share on other sites

Set the each option value to the corresponding email address,

 

<form name="jobs" action="<?=$_SERVER['PHP_SELF'];?>" method="POST">
    <select name="email_to">
        <option value="me@me.com">me</option>
        <option value="him@him.com">him</option>
    </select>
    <input type="submit" value="submit" name="submit">
</form>

 

Then for the from on the email just use $_POST['email_to'];

 

Angus.

Link to comment
Share on other sites

Thank you for your quick responses!  I'm a little confused about the first solution as I need to direct the employment information gathered on our html form to the different email addresses.  Our html form is being processed via formmail.php and the results are emailed to us using a txt template. 

 

I *THINK* the second solution may be more in line with what I am trying to do?  I will try and let you know.

 

If I'm misunderstanding the first solution, please accept my apology and I would love more insight.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.