Connecting Tech Pros Worldwide Help | Site Map

Email form - trouble connecting the submit button

Newbie
 
Join Date: Jan 2006
Posts: 8
#1: Jan 25 '07
Hi,

This is my first flash project! It would be great if someone could help me please.

I have purchased a flash template which I have made some alterations to. My biggest alteration is that of adding a contact form to it.

I am comfortable with PHP, so have done the server side code in PHP. but I can't seem to get the button on my form to trigger my code. I've studied many tutorials about this, but none of them are close enough to my own situation for me to make this work.

Here is the PHP code from my file called, 'contact_process.php':

[php]
<?php
// Send the message
$mailfrom="<$_POST[email]>";
$email="trade@snowweb.net";
$subject="RJEN website - Contact form";
Company:$_POST[company]<br><br>
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: ". $mailfrom."\r\n";
mail($email,$subject,$data,$headers);

echo "message_sent=ok";
?>
[/php]

Here is the action script that I have in the first frame of the actions layer of my movie:

Expand|Select|Wrap|Line Numbers
  1. stop();
  2.  
  3. var company_var = "";
  4.  
  5. login_button.onRelease = function()
  6. {
  7.  
  8. // Create a new LoadVars instance for the form data
  9. var formData:LoadVars = new LoadVars();
  10. // Initialize formData variables:
  11. var formData.company = company_var;
  12.  
  13. formData.sendAndLoad("http://localhost:87/contact_process.php",_blank,"POST");
  14.  
  15. // Tell the user what's happening.
  16. formData.onLoad = function()
  17. {
  18.  
  19. if(formData.message_sent == "ok")
  20. gotoAndStop(2); 
  21. }
  22. else
  23. gotoAndStop(3); 
  24. }
  25. }
  26.  
  27. }
  28.  
The action script for the button is empty. Is that right? If not, what should I put in it bearing in mind that I already have an event handler in the script above, which is in the 'actions' layer, frame 1.

The .fla file can be downloaded here...

http://dev50.snowweb.net/RJEN_ws_v1.0.fla

and the current .swf can be viewed

http://dev50.snowweb.net/RJEN_ws_v1.0.swf

The form, currently only has one field called company, I'll add the rest once I have the methods sorted.

Thanks, in advance, for your help. I really have spent days on this and never thought it could be such rocket science! I take my hat of to those of you who have mastered Flash out there!

Kind regards

Peter Snow
Newbie
 
Join Date: Mar 2007
Location: Richmond, VA
Posts: 1
#2: Mar 21 '07

re: Email form - trouble connecting the submit button


I am new to PHP but the $_POST[email] seems odd I have never seen it used without quotes? i.e.

$email = $_POST['email'];

Have you verified you passed it the email address?

Jim

PS: I tried to download your *.fla but you require a username and password?
Member
 
Join Date: Mar 2007
Posts: 122
#3: Mar 21 '07

re: Email form - trouble connecting the submit button


I think you can do it this way.
$EmailTo = "abc@abc.com";


sandy
Reply