Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 01-26-2009, 09:28 AM php multiple emails
ihsaan's Avatar
Extreme Talker

Posts: 155
Name: Ihsaan
Location: Botswana
Trades: 0
Can someone please assist me with making a php contact form but the user can select which department the email should be sent to and based on that the email is sent. Each department will have 3 email address.. See the form layout here http://www.tharwat.co.za/form.html
__________________

Please login or register to view this content. Registration is FREE
ihsaan is offline
Reply With Quote
View Public Profile Visit ihsaan's homepage!
 
 
Register now for full access!
Old 01-26-2009, 12:34 PM Re: php multiple emails
stevej's Avatar
Professional Multitasker

Posts: 996
Location: Not positive
Trades: 0
If I were you, I would use code similar to this:
HTML Code:
<form method="post">
Name:<br />
<input type="input" name="name"><br />
Email:<br />
<input type="input" name="email"><br /><br />
Department:<br />
<select name="department">
<option value="1">Email 1</option>   
<option value="2">Email 2</option>
<option value="3">Email 3</option>
</select><br /><br />
Query:<br />
<textarea name="query">
</textarea><br /><br />
<input type="submit" value="Submit" name="submit">
</form>
And the php, which goes on the same page,
PHP Code:
<?php
$name 
$_POST['name'];
$email $_POST['email'];
$query $_POST['query'];
$department $_POST['department'];
$headers "From: $name <$email>"
$subject "A Message"
$body "
Name:
$name

Email:
$email

Department:
$department

Query:
$query
"
;
if(
$_POST['submit']){
    if(
$department == '1') {
    
$sendemail "email1@company.com";
    }
    if(
$department == '2') {
    
$sendemail "email3@company.com";
    }
    if(
$department == '3') {
    
$sendemail "email3@company.com";
    }
    
mail($sendemail$subject$body$headers);
}
?>
And you will, of course, have to change the different values to suit your needs.

- Steve
stevej is offline
Reply With Quote
View Public Profile
 
Old 02-12-2009, 06:25 AM Re: php multiple emails
ihsaan's Avatar
Extreme Talker

Posts: 155
Name: Ihsaan
Location: Botswana
Trades: 0
thnx stevo! any idea how i would include a picture into an email from a form?
__________________

Please login or register to view this content. Registration is FREE
ihsaan is offline
Reply With Quote
View Public Profile Visit ihsaan's homepage!
 
Old 02-12-2009, 08:04 AM Re: php multiple emails
Decaf's Avatar
Ultra Talker

Posts: 489
Name: Adam
Trades: 0
Quote:
Originally Posted by ihsaan View Post
thnx stevo! any idea how i would include a picture into an email from a form?
Copy the file to your server and give the user a hyperlink to access it. Or place the html code in the email body.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Decaf is offline
Reply With Quote
View Public Profile Visit Decaf's homepage!
 
Reply     « Reply to php multiple emails
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.31738 seconds with 12 queries