Hi peeps, I'm having a few probs with the following statement:
<?php
$to = $HTTP_POST_VARS['subject'];
if ($to == "General Query")
$to = "info@domain.com";
elseif ($to == "Suggestion")
$to = "admin@domain.com";
elseif ($to == "Help")
$to = "support@domain.com";
elseif ($to == "Advertising")
$to = "admin@domain.com";
elseif ($to == "Other..")
$to = "admin@domain.com";
$name = $HTTP_POST_VARS['name'];
$from = $HTTP_POST_VARS['from'];
$subject = $HTTP_POST_VARS['subject'];
$info = $HTTP_POST_VARS['info'];
$body = $HTTP_POST_VARS['body'];
$email = "from: $name \n inf: $info \n email: $body";
mail($to, $subject, $email, "From: $from");
echo "Thank you for your email to $to"
?>
Therefore, if the subject contains 'Help' from the selected option, the email will be sent to support@domain.com. Not sure if this is working correctly though, because if the subject chosen is 'Other..', then echo says "Thank you for your email to Other.." rather than "Thank you for your email to admin@domain.com".
So, is there a maximum number of elseif's you can have in one if statement? And, is there a better way of achieving the above?
Thanks
Anthill