Results 1 to 3 of 3

Thread: Submit button?

  1. #1
    Join Date
    Oct 2007
    Thanked 0 Times in 0 Posts

    Talking Submit button?

    Howdy Y'all

    Am not really new to flash but still have a long way to go yet and a lot to learn it seams. I got me a template and I am building a new website to replace my old one and have just about finished except for the contact form.

    I have managed to figure out how all the other stuff is done except for the submit button on the contact page. If you go to the site and to the contact page you will see a few fields you fill out and then hit submit. I don't want this to be a mailto setup like the old site.

    Can someone explain or point me in a direction to learn what this button needs to have for action script?

    Thank Ya!!!

  2. #2
    Join Date
    Mar 2007
    Currently: New York/Philadelphia
    Thanked 519 Times in 507 Posts


    I suggest using some simple PHP.

    The easiest way to takcle this is using loadVars. loadVars is specifficaly made for this kind of application - sending to server side scripts.

    From your website, it looks like you have everything already bulit.

    Here is what you would do to send back/forth to the PHP:

    1) For the actionscript below to work, change your instance names to:

    theName // name input field
    theEmail // email input field
    theMessage // message txt area
    sender // submit button
    2) Add the following actionscript to the controlling frame.

    var senderLoad:LoadVars = new LoadVars(); // loadVars variable to send data
    var recieveLoad:LoadVars = new LoadVars();  // loadVars variable to recieve data
    sender.onRelease = function() {  // when you hit the send button
    	senderLoad.theName = theName.text;  // creates variable for the name field
    	senderLoad.theEmail = theEmail.text;  // this is for the email field
    	senderLoad.theMessage = theMessage.text; //  and the message
    	senderLoad.sendAndLoad("",recieveLoad);  // change the URL to your php script
    receiveLoad.onLoad = function() {  //  data that comes back from the PHP
    	if(this.sentOk) {  // if the message was successful
    		theMessage.text = "Success"
    	else { // if the message did not send
    		theMessage.text = "Failure"

    And here is the simple PHP script.

    PHP Code:

    "";  // add your email address
    $subject "Website Contact Form";
    $message "Name: " $theName;
    $message .= "\nEmail: " $theEmail;
    $message .= "\n\nMessage: " $theMessage;
    $headers "From: $theEmail";
    $headers .= "\nReply-To: $theEmail";

    $sentOk mail($to,$subject,$message,$headers);

    "sentOk=" $sentOk;  // sends back a boolean value based on the success of the script


  3. #3
    Join Date
    Oct 2007
    Thanked 0 Times in 0 Posts


    Thank You Medyman!!

    I have been working a little here and there on my new site in my spare time. I am also remodling my house and restoring a 1959 ford truck so spare time is pretty minimal now days.

    I will copy this down and see about making the buttons do something beside sit and look pretty. ;-)


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts