Jump to content

I need a php file for a contact form


Bendeguz

Recommended Posts

Hello all I was wondering if someone could help me with a php script for a contact for in flash?

I have the the script from flash but i cannot find the php file and i am not really good with php.

Would anyone be able to write a php script for the action script from flash?

Here is the script:

 

var totFields = 4;
var _this = this;
var clearFields = function ()
{
    for (i = 1; i <= totFields; i++)
    {
        var _loc1 = _this["txt" + i];
        _loc1.text = _loc1.startText;
    } // end of for
};
for (i = 1; i <= totFields; i++)
{
    var fieldName = this["txt" + i];
    fieldName.tabIndex = i;
    fieldName.startText = fieldName.text;
    fieldName.onSetFocus = function ()
    {
        if (this.text == this.startText)
        {
            this.text = "";
        } // end if
    };
    fieldName.onKillFocus = function ()
    {
        if (this.text == "")
        {
            this.text = this.startText;
        } // end if
    };
} // end of for
_clear.onRelease = function ()
{
    clearFields();
};
_submit.onRelease = function ()
{
    if (txt1.text == txt1.startText || txt2.text == txt2.startText || txt3.text == txt3.startText || txt4.text == txt4.startText)
    {
        clearFields();
        gotoAndStop(3);
    }
    else
    {
        _this.loadVariables("email.php", "POST");
        clearFields();
        gotoAndStop(2);
    } // end else if
};
stop ();

 

Here is my email address if you would not mind emailing

the php script [email protected]

Link to comment
https://forums.phpfreaks.com/topic/134736-i-need-a-php-file-for-a-contact-form/
Share on other sites

Thanks for the reply.

this code is action script for a contact form in flash i would just need it to go to an email address not through a server.

I dont know what you mean by Variables i think it is in the script i posted. i can add the actual field names maybe that will help.

1. Your Name  txt1 in the script which is the name Var

2. Your E-mail  txt2 in the script is the email Var

3. Your Phone Number  txt3 in the script is the phone Var

4. Message  txt4 in the script is the message Var

that the 4 fields on the form

Thanks again

I hope this helped

Dam. I just finished making one on the computer. I can't get on though. I'll post it in parts on here of what I can remember. Dam. I just tried and it seems I am missing half the symbols I need. If you havnt been helped by tomorrow then I wilL give you the whole script. And help you edit it too. Good luck!

 

 

I will post it here and help you adjust it. I can't really be bothered emailing and I can actually help you edit it easily on here.

 

Here it is:


<?php
/* This is the if statement finding if the user clicks on the submit button */
if(isset($_POST['submit']))

{
/* The input of your fields are being set to variables here. When editing, make sure you change the name of the
'name' and 'email' and 'description' fields and I also recommend you change the name of 
the variables to the name of your input field so the code is easier to understand for you and anyone else looking 
at it. NOTE: The 'name' , 'email' , 'description' fields are the IDs given by you to each field in your form, 
these must match those IDs.*/
   $name=$_POST['name'];

   $email=$_POST['email'];
   
   $description=$_POST['description'];
/* If user doesnt put in a name then it says on the screen "You did not enter a Name"*/
   if(strlen($name)<1)

   {

      print "You did not enter a Name.";

   }
/* If they did then it is also checking if they put an email in and doing the same thing if they haven't.*/
   else if(strlen($email)<1)

   {

      print "You did not enter an Email.";

   }
/* Same, here, its checking for a description.*/   
    else if(strlen($description)<1)

   {

      print "You did not enter a Description.";

   }
/* If they have put all the information required in than it continues. */
   else
/* Here, I am defining what the variables 
are. In the variable $message I have exactly 
how I want it layed out and what information I want to come up 
in the email.*/
   {
$subject =  "Contact Enquiry From: '$email'";
$message =    "Name: '$name'\n
Email: '$email'\n
Description: '$description;'\n";
$from = "From: '$email' \n";
/* Here, I am actually sending the email. change '[email protected] 
to your email address. With the variables $subject, $message and $from I 
am defining what is in the message from what I already have defined above. */
mail ("[email protected]" , $subject, $message, $from);
/* I am defining an auto redirect to another page in the header() function.*/
header("Location:http://www.yourhost.com/thankyou.html");
   }

}


?>

Minor addition. Added trim() during strlen check:

<?php
/* This is the if statement finding if the user clicks on the submit button */
if(isset($_POST['submit']))

{
/* The input of your fields are being set to variables here. When editing, make sure you change the name of the 'name' and 'email' and 'description' fields and I also recommend you change the name of the variables to the name of your input field so the code is easier to understand for you and anyone else looking at it. NOTE: The 'name' , 'email' , 'description' fields are the IDs given by you to each field in your form, these must match those IDs.*/
   $name=$_POST['name'];

   $email=$_POST['email'];
   
   $description=$_POST['description'];
/* If user doesnt put in a name then it says on the screen "You did not enter a Name"*/
   if(strlen(trim($name))<1)

   {

      print "You did not enter a Name.";

   }
/* If they did then it is also checking if they put an email in and doing the same thing if they haven't.*/
   else if(strlen(trim($email))<1)

   {

      print "You did not enter an Email.";

   }
/* Same, here, its checking for a description.*/   
    else if(strlen(trim($description))<1)

   {

      print "You did not enter a Description.";

   }
/* If they have put all the information required in than it continues. */
   else
/* Here, I am defining what the variables are. In the variable $message I have exactly how I want it layed out and what information I want to come up in the email.*/
   {
   $subject =  "Contact Enquiry From: '$email'";
   $message =    "Name: '$name' 
Email: '$email' 
Description: '$description;' ";
   $from = "From: '$email' ";
/* Here, I am actually sending the email. change '[email][email protected][/email] to your email address. With the variables $subject, $message and $from I am defining what is in the message from what I already have defined above. */
   mail ("[email][email protected][/email]" , $subject, $message, $from);
/* I am defining an auto redirect to another page in the header() function.*/
   header("Location:http://www.yourhost.com/thankyou.html");
   }

}


?>

Hey Guys

Thanks for the script. Now what do i have to change in it in order to work with my action sript from flash cs3?

also there are 2 different copies of the script on by Akenatehm and one by waynewex. Which one should i use?

Like I said when it comes to php i am a sitting duck.

 

thanks for your help.

Bendeguz

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.