Hi I need to create a basic comments form. What I have a question about is this form needs to enable users to chose a department in an organization and have the form sent to that specific department. how do I go about this?
thanks for your helpBy sending a form, I assume you're talking about sending an email.
First, make a select box with options for each "department" you want to have information sent to:
<select name='dept'>
<option value='cs'>Customer Service</option>
<option value='sales'>Sales</option>
</select>
Then, use the POST variable "dept" as in the select name, and use if (or switch) statments to assign the proper email address to send it to:
if ($_POST['dept'] == "cs")
{
$email = "[email protected]";
}
elseif ($_POST['dept'] == "sales")
{
$email = "[email protected]";
}
// Then use the variable $email for your mail form
mail($email, $subject, $body, $headers);
Hope this helps
thanks for your helpBy sending a form, I assume you're talking about sending an email.
First, make a select box with options for each "department" you want to have information sent to:
<select name='dept'>
<option value='cs'>Customer Service</option>
<option value='sales'>Sales</option>
</select>
Then, use the POST variable "dept" as in the select name, and use if (or switch) statments to assign the proper email address to send it to:
if ($_POST['dept'] == "cs")
{
$email = "[email protected]";
}
elseif ($_POST['dept'] == "sales")
{
$email = "[email protected]";
}
// Then use the variable $email for your mail form
mail($email, $subject, $body, $headers);
Hope this helps