Flash form's "submit" button not working - does nothing

Hi everyone, kind of new to flash, so apologize if this is a basic issue - but then atleast easy way to grab some points ;)

So I am setting up a new website using a flash template I downloaded and so far able to figure out everything for the most part.  The only issue now is that the submit button for the form is not working.  When pressed, you see it being pressed, but does nothing to invoke sending the form.  The template had a mailto function setup, so I modified the email address, etc in there and that did not work.  

So then researching, I found information in using PHP.  So I enabled PHP on my web hosting end, created a php script (copied from one of the message boards), and modified the action in flash template to call this php file. Well, atleast I think I did that.

The site is uploaded at www.innovativenetworks.biz.

Here is a copy of the PHP script:
// Enter your email address here
$adminaddress = "xxxx@innovativenetworks.biz"; 
// Enter the address of your website here MUST include http://www. 
$siteaddress ="http://www.innovativenetworks.biz"; 
// Enter your company name or site name here 
$sitename = "Innovative Networks"; 
// Gets the date and time from your server
$date = date("m/d/Y H:i:s");
// Gets the IP Address
if ($REMOTE_ADDR == "") $ip = "no ip";
else $ip = getHostByAddr($REMOTE_ADDR);
//Process the form data!
// and send the information collected in the Flash form to Your nominated email address
IF ($action != ""): 
mail("$adminaddress","Visitor Comment from YOUR SITE", 
Hello there. You have an email from a visitor who filled out the contact form on your website. Please read below:\n\n
First Name: $name
Company: $company
Email: $vemail
Phone: $phone
The visitor commented:
Logged Info :
Hostname: $ip
IP address: $REMOTE_ADDR
Date/Time:  $date","FROM:$adminaddress"); 
//This sends a confirmation to your visitor
mail("$vemail","Thank You for visiting $sitename", "Hi $name,\n
Thank you for your message to $sitename! We will respond based on your provided information shortly.\n
Best Regards,
//Confirmation is sent back to the Flash form that the process is complete
$sendresult = "Your message has been sucessfully sent!";
$send_answer = "answer=";
$send_answer .= rawurlencode($sendresult);
echo "$send_answer";

Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

The only obvious step you don't mention is modifying the permissions on the uploaded .php file.

Every file on a (unix / linux) web server has 'permissions' associated with it. These are altered using a command called CHMOD followed by the number that corresponds to the attributes you want to set.

To cut a long story short, try this.

Log onto your website using an FTP client (if you don't have one, Google 'Filezilla' which is an excellent free FTP client - make sure it's the *client* software you get)
Locate the file that you list above ("this_is_my_file.php") using your FTP client
Right click the filename, and look for the CHMOD command that should appear. Click it.
Look for a box that allows you to type a number.
Type 755 and click OK
Test to see if your mail function works now.
You should download fiddler2  (www.fiddler2.com)  and monitor the HTTP traffic from your app. I suspect it is not doing anything which implies the submit button is not working. Put an alert int he submit button code to make sure it is being called correctly.

If you can post some flash code that would help also.

frankrizzo1856Author Commented:
Yes, modified permissions and issue still here.  Would it be beneficial for me to post my fla file or even make it available online for you to d/l and take a look at it?
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

frankrizzo1856Author Commented:
Any help is greatly appreciated.

  Did you look at the http traffic? Is the PHP page being called at all?

 Posting the section of code where you call the page would help,

frankrizzo1856Author Commented:
Loaded fiddler on my workstation and went to the site.  The only traffic that showed was my initial lauch of hte site.  No other activity while on the site shows up in fiddler.

GET /innovative3.swf HTTP/1.1
Accept: */*
Accept-Language: en-US
Referer: http://innovativenetworks.biz/
x-flash-version: 10,0,12,36
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; GTB5; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; InfoPath.1; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; MS-RTC EA 2)
Host: innovativenetworks.biz
Connection: Keep-Alive
Try adding system.Security.allowDomain("*");
frankrizzo1856Author Commented:
Forgive me for my flash ignorance ;)  Where should I be putting that command?  I am also not positive the actionscript is addedin the correct spot, any chance I could get you the swf file itself toconfirm that as well?

Thank you sooo much!
Frank... is this resolved yet ? I've had a couple of other ideas if you're still struggling.
frankrizzo1856Author Commented:
Definitely not resolved yet and struggling majorly!!  Any help is GREATLY appreciated!!  I am sure I am just missing something rather simple, but not being that great with flash - not sure what it is.

Let me know if you need/want to take a look at the actual fla file as well.

Yes, please can I see the .fla ? If it's not too big, post it here, if it's above the filesize limit here please email it to me pat (at) quizengine (dot) co (dot) uk
frankrizzo1856Author Commented:
Here you go, thanks so much!!  
Hi. I've looked into this .fla and there is *no* code attached to the submit button, so there's no surprise that nothing's happening.

Flash isn't capable of sending emails, so it needs to use a '3rd party' delivery system - typically a PHP script. Flash can talk to PHP, and PHP can send an email. But Flash can't directly.

So - did the package that came with this Flash template include any PHP file that might send an email for you ? Actually, that's a dumb question - if there had been a PHP email script with the package, then the submit button would have been linked to it. And it wasn't, so I guess you didn't get that with your template...

So - do you have expertise in PHP and could write yourself an email script ? If you can do that, I can show you how to link the button. My best advice - if you can, write a PHP email script then get back to me and I'll tell you how to link it to the button. If you can't then either raise another question here to answer that, or email me privately to discuss other options.
frankrizzo1856Author Commented:
I have the php script listed in my initial post, do I need something additional?
Sorry. That's really dumb of me not to spot that. That's good that you have it, and I can see what variables it's expecting Flash to pass out. Now I need to know the filename of this PHP script, then I can tell you the code to put on the button.

Also do you understand about CHMOD - for example, if I said "When you upload the script to your server you need to CHMOD 755 the file" would you know how to do that ?
frankrizzo1856Author Commented:
File is innov.php and yes, understand the chmod for the file permissions.
frankrizzo1856Author Commented:
Hi quizengine, any luck?  Thanks.
Hi. Sorry to get your hopes up but when I dug further into the movie I couldn't make sense of all of the code and variables there. Sorry I can't help.
frankrizzo1856Author Commented:
Hey quizengine, no worries.

I actually am making some headway I think.  After some more research, I found out that setting permissions to 777 on the php script is a no no and that it requires 755.  So did that and now do not receive the 500 internal server error I was getting if I browsed directly to my php file.  I also changed the actionscript for the submit button from loadvariables to geturl, again something I found on a site.  

With these changes, I actually do see some activity.  A second browser window opens and I receve the following error message:

Parse error: syntax error, unexpected T_STRING in /home/xxx/public_html/xxx/innov.php on line 26

The PHP code I am using is in my original post and line 26 is the following line:

Hello there. You have an email from a visitor who filled out the contact form on your website. Please read below:\n\n
So any thoughts on what the incorrect syntax is in the script?


Sorry, Flash is my area of expertise, not PHP - my PHP scripts are *very* simple.
frankrizzo1856Author Commented:
Hi Quizengine, my friend - I am back!  ;)

So I have been diligently playing around with this issue and actually making some headway, well sort of.

I have gotten the actionscript to recognize the php script.  When I hit the submit button now, the status bar says waiting for xxx.biz for a very long time.  I then do get an email sent based on the form.  The current issues are:

1. The emails I am getting from the site are blank, well are missing the values from the input fields from the site.  Any regular text from my php file is sent in the email, just not any of the variables.

2. How do I modify my flash site so it gives some sort of confirmation on the site that they have successfully submitted the form to me?

Attaching the php code as well.  Any thoughts?


// First, set up some variables to serve you in
// getting an email.  This includes the email this is
// sent to (yours) and what the subject of this email
// should be.  It's a good idea to choose your own
// subject instead of allowing the user to.  This will
// help prevent spam filters from snatching this email
// out from under your nose when something unusual is put.
$sendTo = "xxx@yyy.com";
$subject = "Website Contact Form";
$email   = $_POST['email'];
$name    = $_POST['name'];
$phone   = $_POST['phone'];
$company = $_POST['company'];
$comments = $_POST['comments'];
// variables are sent to this PHP page through
// the POST method.  $_POST is a global associative array
// of variables passed through this method.  From that, we
// can get the values sent to this page from Flash and
// assign them to appropriate variables which can be used
// in the PHP mail() function.
// header information not including sendTo and Subject
// these all go in one variable.  First, include From:
$headers = "From: " . $_POST["name"] ." <" . $_POST["email"] .">\r\n";
// next include a replyto
$headers .= "Reply-To: " . $_POST["email"] . "\r\n";
// often email servers won't allow emails to be sent to
// domains other than their own.  The return path here will
// often lift that restriction so, for instance, you could send
// email to a hotmail account. (hosting provider settings may vary)
// technically bounced email is supposed to go to the return-path email
$headers .= "Return-path: " . $_POST["email"];
// now we can add the content of the message to a body variable
$message = " $todayis [EST] \n
Customer: $name \n
E-Mail: $email \n
Company: $company \n
Phone: $phone \n
Comments: $comments \n
// once the variables have been defined, they can be included
// in the mail function call which will send you an email
mail($sendTo, $subject, $message, $headers);

Open in new window

Again, my forte is Flash, not PHP. My PHP scripts are very simple and I have no idea how to get the PHP to pass a 'fail/success' message back to the Flash - mine don't.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Flash

From novice to tech pro — start learning today.