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 in 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).
I posted last week and I had to many parameters but I have now got them down to three so I hope that is OK so I am purely looking for the users input to be returned.
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...
[CODE=php]
<?php
$to = 'me@myemailaddr ess.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);
?>
[/CODE]
Actionscript...
[CODE=actionscri pt]
stop();
var fullName:TextFi eld;
var fullAddress:Tex tField;
var postcode:TextFi eld;
var telNumber:TextF ield;
var emailAddress:Te xtField;
fullName.restri ct = "A-Za-zÁáÉéêíÍãõç ";
fullName.maxCha rs = 40;
fullAddress.res trict = "0-9A-Za-zÁáÉéêíÍãõç!?.+ \- ";
fullAddress.max Chars = 90;
postcode.restri ct = "0-9A-Za-zÁáÉéêíÍãõç!?.+ \- ";
postcode.maxCha rs = 10;
telNumber.restr ict = "0-9A-Za-zÁáÉéêíÍãõç!?.+ \- ";
telNumber.maxCh ars = 20;
emailAddress.re strict = "0-9A-Za-zÁáÉéêíÍãõç!?.+ \- ";
emailAddress.ma xChars = 50;
function sendEmail(fullN ame, fullAddress, postcode, telNumber, emailAddress)
{
var myData:LoadVars = new LoadVars();
myData.fullName = fullName.text;
myData.fullAddr ess = fullAddress.tex t;
myData.postcode = postcode.text;
myData.telNumbe r = telNumber.text;
myData.emailAdd ress = emailAddress.te xt;
}
this.submitButt on.onRelease = function()
{
if (fullName.text == "" || fullAddress.tex t == "" || postcode.text == "" || telNumber.text == "")
{
gotoAndStop("er ror");
}
else
{
sendEmail();
gotoAndStop("co rrect");
}
myData.sendAndL oad("iopost.php ", myData, "POST");
};
[/CODE]
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).
I posted last week and I had to many parameters but I have now got them down to three so I hope that is OK so I am purely looking for the users input to be returned.
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...
[CODE=php]
<?php
$to = 'me@myemailaddr ess.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);
?>
[/CODE]
Actionscript...
[CODE=actionscri pt]
stop();
var fullName:TextFi eld;
var fullAddress:Tex tField;
var postcode:TextFi eld;
var telNumber:TextF ield;
var emailAddress:Te xtField;
fullName.restri ct = "A-Za-zÁáÉéêíÍãõç ";
fullName.maxCha rs = 40;
fullAddress.res trict = "0-9A-Za-zÁáÉéêíÍãõç!?.+ \- ";
fullAddress.max Chars = 90;
postcode.restri ct = "0-9A-Za-zÁáÉéêíÍãõç!?.+ \- ";
postcode.maxCha rs = 10;
telNumber.restr ict = "0-9A-Za-zÁáÉéêíÍãõç!?.+ \- ";
telNumber.maxCh ars = 20;
emailAddress.re strict = "0-9A-Za-zÁáÉéêíÍãõç!?.+ \- ";
emailAddress.ma xChars = 50;
function sendEmail(fullN ame, fullAddress, postcode, telNumber, emailAddress)
{
var myData:LoadVars = new LoadVars();
myData.fullName = fullName.text;
myData.fullAddr ess = fullAddress.tex t;
myData.postcode = postcode.text;
myData.telNumbe r = telNumber.text;
myData.emailAdd ress = emailAddress.te xt;
}
this.submitButt on.onRelease = function()
{
if (fullName.text == "" || fullAddress.tex t == "" || postcode.text == "" || telNumber.text == "")
{
gotoAndStop("er ror");
}
else
{
sendEmail();
gotoAndStop("co rrect");
}
myData.sendAndL oad("iopost.php ", myData, "POST");
};
[/CODE]
Comment