homepage Welcome to WebmasterWorld Guest from 54.166.110.222
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Flash and Shockwave
Forum Library, Charter, Moderator: open

Flash and Shockwave Forum

    
Email form - trouble connecting the submit button
need help connecting submit button to function
snowweb




msg:3230972
 3:16 am on Jan 25, 2007 (gmt 0)

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
// Send the message
$mailfrom="<$_POST[email]>";
$email="trade@example.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";
?>

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

stop();

var company_var = "";

login_button.onRelease = function()
{

// Create a new LoadVars instance for the form data
var formData:LoadVars = new LoadVars();
// Initialize formData variables:
var formData.company = company_var;

formData.sendAndLoad("http://localhost:87/contact_process.php",_blank,"POST");

// Tell the user what's happening.
formData.onLoad = function()
{

if(formData.message_sent == "ok")
{
gotoAndStop(2);
}
else
{
gotoAndStop(3);
}
}

}

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 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

[edited by: jatar_k at 1:25 pm (utc) on Jan. 25, 2007]
[edit reason] no urls thanks [/edit]

 

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Flash and Shockwave
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved