...

View Full Version : Flash contact form works with all browsers except Chrome. Help!



Sd&f
05-14-2012, 03:36 AM
I have scoured the internet looking for an answer to this problem. I could really use some help. My Flash form works perfectly on every other browser but doesnt work on Chrome. When tested on my home computer it works occasionally (maybe one out of 3 times) but from G.A. I can see that a number of people have filled it out and I never received the email. Chrome is the only thing they all have in common.
My action script code is:

submit_btn.addEventListener(MouseEvent.CLICK, sendMessage);
function sendMessage(e:MouseEvent):void{
var my_vars:URLVariables = new URLVariables();
my_vars.senderName = name_txt.text;
my_vars.senderEmail = email_txt.text;
my_vars.senderMsg = zip_txt.text;
my_vars.senderNumber = number_txt.text;

var my_url:URLRequest = new URLRequest("mail.php");
my_url.method = URLRequestMethod.POST;
my_url.data = my_vars;

var my_loader:URLLoader = new URLLoader();
my_loader.dataFormat = URLLoaderDataFormat.VARIABLES;
my_loader.load(my_url);

then it sends them to a thank you page.

My php code is:

<?php
$to = "myemail@myemail.com";
$subject = ($_REQUEST['senderName']);
$message = ($_REQUEST['senderMsg']);
$number = ($_REQUEST['senderNumber']);
$message .= "\n\n---------------------------\n";
$message .= "E-mail Sent From: " . $_REQUEST['senderName'] . " <" . $_REQUEST['senderNumber'] ." <" . $_REQUEST['senderEmail'] . ">\n";
$headers = "From: " . $_REQUEST['senderName'] . " <" . $_REQUEST['senderEmail'] . ">\n";
if (mail($to, $subject, $message, $headers))
{
echo "answer=ok";
}
else
{
echo "answer=error";
}
?>

If anyone has a suggestion on how to make this work with Chrome as well I would appreciate it.

djpaul1963
05-14-2012, 10:29 AM
Just a thought. Try to set the full url to the URL request ("http://www.mysite.com/mail.php") and not just mail.php

Sd&f
05-14-2012, 12:35 PM
Thank you for your reply. I will try that. Its very frustrating that this code works perfectly on every other browser but Chrome.

Sd&f
05-15-2012, 01:43 AM
the form work perfectly today with IE and then not again with Chrome. I am very frustrated! I would appreciate so very much help with this problem.

Sd&f
05-15-2012, 02:38 AM
Just a thought. Try to set the full url to the URL request ("http://www.mysite.com/mail.php") and not just mail.php

I edited the script and tested it i received the email 3 out of 5 times.
Which doesnt make sense at all. Either it works or it doesnt. And I believe when a visitor completes the form the first time its most likely not going to send.
Thank you for your response.

djpaul1963
05-15-2012, 10:21 AM
Did you tried to add a listener on URLLoader and see what happens? Have a look here http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/URLLoader.html

Another possible cause could be HTTP caches. Try to disable them by using URLRequest.requestHeaders.push( new URLRequestHeader( 'Cache-Control', 'no-cache' ) );



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum