DougieMcN
Technical User
- Sep 16, 2007
- 13
Hi, I've set up a form in flash which will send data to a PHP file on my web space, which in return will return the data from the textfields to my e-mail address. I know PHP is enabled on my web server because I tested it and it's OK.
Please can anyone check my PHP script below to see if I am missing something that would cause my e-mails not to be returned (I'm new to PHP).
The PHP script is below (I've put the Actionscript code as well in-case someone notices something there)
I have tested this in an HTML page on my web server but no response from my form is received.
Thanks in advance.
PHP script...
<?php
$to = 'me@myemailaddress.co.uk';
$subject = 'Request';
$message = '';
$message .= "\n";
$message .= "Name: $fullName";
$message .= "\n\n";
$message .= "Address: $fullAddress";
$message .= "\n\n";
$message .= "Postcode: $postcode";
$message .= "\n\n";
$message .= "Tel: $telNumber";
$message .= "\n\n";
$message .= "E-mail: $emailAddress";
$sent = mail ($to, $subject, $message);
?>
Actionscript code...
stop();
var fullName:TextField;
var fullAddress:TextField;
var postcode:TextField;
var telNumber:TextField;
var emailAddress:TextField;
fullName.restrict = "A-Za-zÁáÉéêíÍãõç ";
fullName.maxChars = 40;
fullAddress.restrict = "0-9A-Za-zÁáÉéêíÍãõç!?.+\- ";
fullAddress.maxChars = 90;
postcode.restrict = "0-9A-Za-zÁáÉéêíÍãõç!?.+\- ";
postcode.maxChars = 10;
telNumber.restrict = "0-9A-Za-zÁáÉéêíÍãõç!?.+\- ";
telNumber.maxChars = 20;
emailAddress.restrict = "0-9A-Za-zÁáÉéêíÍãõç!?.+\- ";
emailAddress.maxChars = 50;
function sendEmail(fullName, fullAddress, postcode, telNumber, emailAddress)
{
var myData:LoadVars = new LoadVars();
myData.fullName = fullName.text;
myData.fullAddress = fullAddress.text;
myData.postcode = postcode.text;
myData.telNumber = telNumber.text;
myData.emailAddress = emailAddress.text;
}
this.submitButton.onRelease = function()
{
if (fullName.text == "" || fullAddress.text == "" || postcode.text == "" || telNumber.text == "")
{
gotoAndStop("error");
}
else
{
sendEmail();
gotoAndStop("correct");
}
myData.sendAndLoad("iopost.php", myData, "POST");
};
Please can anyone check my PHP script below to see if I am missing something that would cause my e-mails not to be returned (I'm new to PHP).
The PHP script is below (I've put the Actionscript code as well in-case someone notices something there)
I have tested this in an HTML page on my web server but no response from my form is received.
Thanks in advance.
PHP script...
<?php
$to = 'me@myemailaddress.co.uk';
$subject = 'Request';
$message = '';
$message .= "\n";
$message .= "Name: $fullName";
$message .= "\n\n";
$message .= "Address: $fullAddress";
$message .= "\n\n";
$message .= "Postcode: $postcode";
$message .= "\n\n";
$message .= "Tel: $telNumber";
$message .= "\n\n";
$message .= "E-mail: $emailAddress";
$sent = mail ($to, $subject, $message);
?>
Actionscript code...
stop();
var fullName:TextField;
var fullAddress:TextField;
var postcode:TextField;
var telNumber:TextField;
var emailAddress:TextField;
fullName.restrict = "A-Za-zÁáÉéêíÍãõç ";
fullName.maxChars = 40;
fullAddress.restrict = "0-9A-Za-zÁáÉéêíÍãõç!?.+\- ";
fullAddress.maxChars = 90;
postcode.restrict = "0-9A-Za-zÁáÉéêíÍãõç!?.+\- ";
postcode.maxChars = 10;
telNumber.restrict = "0-9A-Za-zÁáÉéêíÍãõç!?.+\- ";
telNumber.maxChars = 20;
emailAddress.restrict = "0-9A-Za-zÁáÉéêíÍãõç!?.+\- ";
emailAddress.maxChars = 50;
function sendEmail(fullName, fullAddress, postcode, telNumber, emailAddress)
{
var myData:LoadVars = new LoadVars();
myData.fullName = fullName.text;
myData.fullAddress = fullAddress.text;
myData.postcode = postcode.text;
myData.telNumber = telNumber.text;
myData.emailAddress = emailAddress.text;
}
this.submitButton.onRelease = function()
{
if (fullName.text == "" || fullAddress.text == "" || postcode.text == "" || telNumber.text == "")
{
gotoAndStop("error");
}
else
{
sendEmail();
gotoAndStop("correct");
}
myData.sendAndLoad("iopost.php", myData, "POST");
};