I posted this below, bit it turned most of my post white so people couldn't read it! Let's try again: If it does it again, highlight the white to turn blue.
Hi, I'm trying to use the following script to send mail to any address given in the previous form.
But, it only works with a static e-mail address on the mailto: line. What's wrong with it? Why won't the following work?
<?
$i=0;
if (!is_array($HTTP_POST_VARS))
return;
reset($HTTP_POST_VARS);
while(list($key, $val) = each($HTTP_POST_VARS)) {
$GLOBALS[$key] = $val;
$val=stripslashes($val);
echo "$key = $val<br>";
}
function reimport_any_vars($arrayname) {
$mailto= "$email"; <== WHAT'S WRONG??
$subject= "Feedback";
$from= "The Panthers' Cage";
global $$arrayname;
if (!is_array($$arrayname))
return;
reset($$arrayname);
while(list($key, $val) = each($$arrayname)) {
$GLOBALS[$key] = $val;
$val=stripslashes($val);
$line[$i]= "$key = $val
";
$message= "$message$line[$i]";
$i++;
}
$footer= "
Questions? Problems?
E-mail: mitya@themoon.co.uk
Or call: (555) 555-5555";
$message= "$message$footer";
mail( "$mailto", "$subject", "$message", "From: $from");
}
reimport_any_vars( "HTTP_POST_VARS");
?>
Thanks in advance.