Go Back   CodingForums.com > :: Client side development > Flash & ActionScript

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-14-2012, 03:36 AM   PM User | #1
Sd&f
New Coder

 
Join Date: May 2012
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Sd&f is an unknown quantity at this point
Flash contact form works with all browsers except Chrome. Help!

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.
Sd&f is offline   Reply With Quote
Old 05-14-2012, 10:29 AM   PM User | #2
djpaul1963
New Coder

 
Join Date: Apr 2012
Location: Athens GR
Posts: 58
Thanks: 0
Thanked 6 Times in 6 Posts
djpaul1963 is an unknown quantity at this point
Just a thought. Try to set the full url to the URL request ("http://www.mysite.com/mail.php") and not just mail.php
djpaul1963 is offline   Reply With Quote
Old 05-14-2012, 12:35 PM   PM User | #3
Sd&f
New Coder

 
Join Date: May 2012
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Sd&f is an unknown quantity at this point
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 is offline   Reply With Quote
Old 05-15-2012, 01:43 AM   PM User | #4
Sd&f
New Coder

 
Join Date: May 2012
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Sd&f is an unknown quantity at this point
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 is offline   Reply With Quote
Old 05-15-2012, 02:38 AM   PM User | #5
Sd&f
New Coder

 
Join Date: May 2012
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Sd&f is an unknown quantity at this point
Quote:
Originally Posted by djpaul1963 View Post
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.
Sd&f is offline   Reply With Quote
Old 05-15-2012, 10:21 AM   PM User | #6
djpaul1963
New Coder

 
Join Date: Apr 2012
Location: Athens GR
Posts: 58
Thanks: 0
Thanked 6 Times in 6 Posts
djpaul1963 is an unknown quantity at this point
Did you tried to add a listener on URLLoader and see what happens? Have a look here http://help.adobe.com/en_US/FlashPla...URLLoader.html

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

Bookmarks

Tags
chrome, contact form

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:09 AM.


Advertisement
Log in to turn off these ads.