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
|