Hey, I'm trying to make my Flash CS3 file send an email through PHP using ActionScript 2.0
However, for some odd reason, it's not working!! Once or twice, it DOES send the email... but just once or twice (I can't seem to find any pattern) -- but even then all the variables show up us empty.
Here's the code for the ActionScript in Flash:
Code:
on(release){
var sendInfo:LoadVars = new LoadVars();
var getInfo:LoadVars = new LoadVars();
//Readying variables to send
sendInfo.cust_name = _root.nameInput.text;
sendInfo.cust_mail = _root.mailInput.text;
sendInfo.cust_phone = _root.phoneInput.text;
sendInfo.cust_msg = _root.msgInput.text;
//Sending variables to PHP handler
sendInfo.sendAndLoad("mail.php", getInfo, "POST");
}
And here's the PHP:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled</title>
</head>
<body>
<!-- PHP Mail Coding starts here -->
<?php
session_start();
$name=$_POST['cust_name'];
checkOK($name);
$email=$_POST['cust_mail'];
checkOK($email);
$msg=$_POST['cust_msg'];
checkOK($msg);
$msg = str_replace("\n", "<br>", $msg);
$msg = str_replace("\r", "<br>", $msg);
$phone=$_POST['cust_phone'];
$to='myemail@whatever.com'; //Mail will be sent to e-mail address
$message="
<HTML>
<head>
<title>Feedback Form Mail</title>
</head>
<body>
<font color=red><b> $name </b></font>just filled in your contact form.<br>
E-Mail:<font color=blue><b> $email </b></font><br>
Phone:<b> $phone </b><br>
They said:<br>
<h4>
$msg
<br></h4>
</body></HTML>
";
// Content-type header for HTML e-mail
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
mail($to,'Comments From Your Site',$message,$headers);
?>
</body>
</html>
Can someone PLEASE help me out? 
Last edited by uttaresh; 08-12-2008 at 05:34 PM..
|