Receiving Blank Emails from Flash Contact Form

  • kisso
  • Born
  • Born
  • kisso
  • Posts: 2

Post 3+ Months Ago

Please help, I've tried everything and can't figure this out
I created a contact form in flash and keep getting blank emails when I test it.


FLASH

Code: [ Select ]
function clearField()
{
    theName.text = label1;
    theEmail.text = label2;
    thePhone.text = label3;
    theMessage.text = label4;
}//End of the Function
label1 = "Your Name:";
label2 = "Telephone:";
label3 = "E-Mail Address:";
label4 = "Message:";
countField = 4;
clearField();
var arrayLabel = new Array();
for (i = 1; i < countField + 1; i++)
{
    txtField = this["txtField" + i];
    txtField.index = i;
    arrayLabel[i] = this["label" + i];
    txtField.tabIndex = i;
    txtField.onSetFocus = function ()
    {
        if (this.text == arrayLabel[this.index])
        {
            this.text = "";
        }      // end if
    };
    txtField.onKillFocus = function ()
    {
        if (this.text == "")
        {
            this.text = arrayLabel[this.index];
        }      // end if
    };
} // end of for
btnClear.onRollOver = function ()
{
    this.gotoAndPlay("over");
};
btnClear.onRollOut = btnClear.onReleaseOutside = function ()
{
    this.gotoAndPlay("out");
};
btnClear.onRelease = function ()
{
    clearField();
};
sender.onRollOver = function ()
{
    this.gotoAndPlay("over");
};
sender.onRollOut = btnSubmit.onReleaseOutside = function ()
{
    this.gotoAndPlay("out");
};
sender.onRelease = function ()
{
    if (_root.pages.pagess.page5.contactform.theName.text == label1 || _root.pages.pagess.page5.contactform.theEmail.text == label2 || _root.pages.pagess.page5.contactform.thePhone.text == label3 || _root.pages.pagess.page5.contactform.theMessage.text == label4)
    {
        gotoAndStop(3);
    }
    else
    {
        _root.pages.pagess.page5.contactform.loadVariables("http://www.server.com/email.php", "POST");
        gotoAndStop(2);
    } // end else if
};
stop ();
  1. function clearField()
  2. {
  3.     theName.text = label1;
  4.     theEmail.text = label2;
  5.     thePhone.text = label3;
  6.     theMessage.text = label4;
  7. }//End of the Function
  8. label1 = "Your Name:";
  9. label2 = "Telephone:";
  10. label3 = "E-Mail Address:";
  11. label4 = "Message:";
  12. countField = 4;
  13. clearField();
  14. var arrayLabel = new Array();
  15. for (i = 1; i < countField + 1; i++)
  16. {
  17.     txtField = this["txtField" + i];
  18.     txtField.index = i;
  19.     arrayLabel[i] = this["label" + i];
  20.     txtField.tabIndex = i;
  21.     txtField.onSetFocus = function ()
  22.     {
  23.         if (this.text == arrayLabel[this.index])
  24.         {
  25.             this.text = "";
  26.         }      // end if
  27.     };
  28.     txtField.onKillFocus = function ()
  29.     {
  30.         if (this.text == "")
  31.         {
  32.             this.text = arrayLabel[this.index];
  33.         }      // end if
  34.     };
  35. } // end of for
  36. btnClear.onRollOver = function ()
  37. {
  38.     this.gotoAndPlay("over");
  39. };
  40. btnClear.onRollOut = btnClear.onReleaseOutside = function ()
  41. {
  42.     this.gotoAndPlay("out");
  43. };
  44. btnClear.onRelease = function ()
  45. {
  46.     clearField();
  47. };
  48. sender.onRollOver = function ()
  49. {
  50.     this.gotoAndPlay("over");
  51. };
  52. sender.onRollOut = btnSubmit.onReleaseOutside = function ()
  53. {
  54.     this.gotoAndPlay("out");
  55. };
  56. sender.onRelease = function ()
  57. {
  58.     if (_root.pages.pagess.page5.contactform.theName.text == label1 || _root.pages.pagess.page5.contactform.theEmail.text == label2 || _root.pages.pagess.page5.contactform.thePhone.text == label3 || _root.pages.pagess.page5.contactform.theMessage.text == label4)
  59.     {
  60.         gotoAndStop(3);
  61.     }
  62.     else
  63.     {
  64.         _root.pages.pagess.page5.contactform.loadVariables("http://www.server.com/email.php", "POST");
  65.         gotoAndStop(2);
  66.     } // end else if
  67. };
  68. stop ();


and this is the PHP

Code: [ Select ]
<?php

$destination="email@server.com";
$name=$_POST['theName'];
$phone=$_POST['thePhone'];
$email=$_POST['theEmail'];
$message=$_POST['theMessage'];
$subject="Message from $name Online Inquiry" ;
$message="Name : $name\n
Phone: $phone\n
Email: $email\n
Comments: $message\n";
mail($destination,$subject,$message);
?>
  1. <?php
  2. $destination="email@server.com";
  3. $name=$_POST['theName'];
  4. $phone=$_POST['thePhone'];
  5. $email=$_POST['theEmail'];
  6. $message=$_POST['theMessage'];
  7. $subject="Message from $name Online Inquiry" ;
  8. $message="Name : $name\n
  9. Phone: $phone\n
  10. Email: $email\n
  11. Comments: $message\n";
  12. mail($destination,$subject,$message);
  13. ?>
  • kisso
  • Born
  • Born
  • kisso
  • Posts: 2

Post 3+ Months Ago

Can Someone please take a look at this?
I would really appreciate the help
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23455
  • Loc: Woodbridge VA

Post 3+ Months Ago

try loadVariablesNum

I've never been able to get loadVariables to work for me.

Also check this post for additional tips.
flash-forum/send-mail-via-php-using-flash-t83259.html?hilit=email

In the php script, It's also a good idea to test if your post variables are set as in my example there

Code: [ Select ]
<?
if (isset($HTTP_POST_VARS)) {

$name = $HTTP_POST_VARS["name"];
$phone = $HTTP_POST_VARS["phone"];
$email = $HTTP_POST_VARS["email"];
$message = $HTTP_POST_VARS["message"];
}
  1. <?
  2. if (isset($HTTP_POST_VARS)) {
  3. $name = $HTTP_POST_VARS["name"];
  4. $phone = $HTTP_POST_VARS["phone"];
  5. $email = $HTTP_POST_VARS["email"];
  6. $message = $HTTP_POST_VARS["message"];
  7. }
  • IceCold
  • Guru
  • Guru
  • User avatar
  • Posts: 1254
  • Loc: Ro

Post 3+ Months Ago

I wonder why people don't start using classes. Is much better since you can reuse them over and over again.

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: No registered users and 8 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.