Hello,
I’m currently running a mail form through flash where people can submit their e-mail address. I host my site through dreamhost and they already have a neat Announcement list CGI module that collects the subscribers online and a lot of other features. What i’d like to do is figure out the simplest way to switch over to the Dreamhost version.
My Version:
sendBtn.onRelease = function() {
trace("mailList Submit");
if (thanks.text != "") {
sendVar = new LoadVars();
getVar = new LoadVars();
sendVar.email = thanks.text;
thanks.text = "Transmitting";
getVar.onLoad = function(success) {
if (success) {
thanks.text = this.stat;
} else {
thanks.text = "Flash Error";
}
};
sendVar.sendAndLoad("form.php", getVar, "POST");
}
};
// ----------------------------------------------------------------------------
myListener = new Object();
myListener.onKeyDown = function () {
if(Key.isDown(Key.ENTER)){
sendBtn.onRelease();
}
}
Key.addListener(myListener);
// ----------------------------------------------------------------------------
thanks.onSetFocus = function () {
thanks.text = "";
};
<?PHP
$email = $_POST['email'];
if (!preg_match("/.*@.*..*/", $email) | preg_match("/(<|> )/", $email)) {
print ("&stat=Invalid Email Address");
exit;
}
$to = "[email protected]";
$msg = "$email
";
$subj = "Mailing List";
$header = "From: $email <$email>
";
$header .= "Reply-To: $email
";
$isSent = mail($to, $subj, $msg, $header);
print ($isSent) ? "&stat=Thank You!" : "&stat=Error Sending Mail";
?>