Jump to content
Killersites Forums

PHP Form with Drop Down


Jsheffers
 Share

Recommended Posts

Let me explain what I am trying to achieve here. I am doing a site for a real estate company which has a PHP form. I have it setup where you type in your name email, and a message. I also have a drop down menu of choices to pick from. Each category needs to be sent to a different persons email, and all of the messages need to go to the boss. Here is what I have so far.

 

<?php

 

$destination=$_POST['emailCategory'];

 

$name=$_POST['name'];

$emailCategory=$_POST['emailCategory'];

$email=$_POST['email'];

$from ="Website Inquiry";

$phone=$_POST['phone'];

$mes=$_POST['mes'];

$header="From: $name";

$newMes="Name: $name\n

Category: $category\n

Email: $email\n

Phone: $phone\n

Message: $mes\n";

 

 

mail($destination,$from,$newMes,"From: Website Inquiry");

mail("test@mac.com",$from,$newMes,"From: Website Inquiry");

 

 

header( 'Location: test.html' );

?>

 

 

The html looks like this....

 

Name:

 

Category

...Select a Category

Vacation Rentals

Yearly Rentals

Property Management

Work Order Request

Other

 

Email:

 

Phone:

 

Message:

 

 

Any Help would be greatly appreciated

Edited by Jsheffers
Link to comment
Share on other sites

Ok here is the problem. The OTHER category for example. I want that to go to the bosses email, which in the code above his email is test@mac.com. But they way I have it setup now he gets two emails. One from the emailCategory VAR, which is being fed an email address from the form. Then I have it calling another mail method which goes straight to the boss. If I BCC the boss what should I set the value"" for the categories that only the boss is getting? I hope that made sense, I'm still learning so I apologize if I'm not explaining it properly.

Link to comment
Share on other sites

Can't get the BCC to work... Here is my code...

 

 

 

<?php

 

$destination=$_POST['emailCategory'];

 

 

 

$name=$_POST['name'];

$emailCategory=$_POST['emailCategory'];

$email=$_POST['email'];

$from ="Website Inquiry";

$phone=$_POST['phone'];

$mes=$_POST['mes'];

$header="From: $name";

$newMes="Name: $name\n

Category: $category\n

Email: $email\n

Phone: $phone\n

Message: $mes\n";

 

 

$headers .= 'Bcc: test@mac.com' . "\r\n";

 

mail($destination,$from,$newMes,$headers,"From: Website Inquiry");

 

//This line sends you to the thank you page

 

header( 'Location: http://www.test.com/thanks.html' );

?>

Edited by Jsheffers
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

Loading...
 Share

×
×
  • Create New...