Yeah in post #4 that was the exact example script as I saw it, but I wondered why $user was blank like $user = ''; I hadn't quite figured out how it would all adapt yet so I'm sure that was part of the problem.
get_data function
Code:
function get_data($var) {
global $c;
if (isset($c[$var])) {
echo $c[$var];
}
}
Thanks for catching that...not sure why I had "#" in this version, in a previous version I had
Code:
action="<?php echo $_SERVER['PHP_SELF']; ?>"
I started to wonder if $user appeared too much in the script, and I think I found a way that makes it work and may be a little more efficient. Posting so anyone else can take a look...
CODE THAT WORKS
Select is simply...
Code:
<select name="recipient">
<option value="">Choose a recipient</option>
<option value="Sales">Sales</option>
<option value="Support">Support</option>
<option value="Service">Service</option>
</select>
Right above my php mail() function I used...
PHP Code:
$recipients = array(
'Sales' => 'sales@yourdomain.com',
'Support' => 'support@yourdomain.com',
'Service' => 'service@yourdomain.com'
);
$my_email = $recipients[$_REQUEST['recipient']];
The if statment that includes the mail() function, so you can see how $my_email relates...
Code:
if (mail($my_email,$subject,$message,$headers)) {
Some of the other select code seemed a little quirky, and using the GET method for user was ok because the url wasn't that long, but I wanted to try to avoid it for the whole form since the url passing everything could get a little messy. Your posts got the wheels turning and I appreciate the feedback.
Bookmarks