Jump to content

Sending form results to various email addresses based on dropdown


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 "[email protected]", "Colorado Springs, CO" would go to "[email protected]"? 

 

Thank you for your help!  :)

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: [email protected]' . "\r\n" .
    'Reply-To: [email protected]' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

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

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

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="[email protected]">me</option>
        <option value="[email protected]">him</option>
    </select>
    <input type="submit" value="submit" name="submit">
</form>

 

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

 

Angus.

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.

 

I think the first response was the same as the second, he just put some text in for a value instead of fake email address.

The top of his post says...

 

just make the value the email address

 

hehe.. had me going there until I took a second look at it ;)

 

Cheers!

Stephen

 

 

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.