Trouble with contact php form code in AS3 code

  • jakecusack
  • Born
  • Born
  • jakecusack
  • Posts: 2

Post 3+ Months Ago

Hello All, I hope someone can help? I have created my first flash site jakecusack and I have and issue with the contact form, I have added my domain and contact php but nothing gets through, I have spoken to my isp and they have given me the following code
<?php

$EmailFrom = "info@mydomain";
$EmailTo = "info@mydomain";
$Subject = "online form";
$Name = Trim(stripslashes($_POST['Name']));
$Email = Trim(stripslashes($_POST['Email']));
$Tel = Trim(stripslashes($_POST['Tel']));
$Message = Trim(stripslashes($_POST['Message']));
// validation
$validationOK=true;
if (!$validationOK) {
echo "please check your details";
header("Location: http://mydomain/contact.php");
exit;
}

// prepare email body text

$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "Tel: ";
$Body .= $Tel;
$Body .= "\n";
$Body .= "Email: ";
$Body .= $Email;
$Body .= "\n";
$Body .= "Message: ";
$Body .= $Message;
$Body .= "\n";

// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");

// redirect to success page
if ($success){
print "<meta http-equiv=\"refresh\" content=\"1;URL=index.php\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"1;URL=index.php\">";
}
?>
---------------------------------------------------------------------------------------------------------
I am not sure how this integrates with the code I already have in place for it to work?
---------------------------------------------------------------------------------------------------------
import flashnet.URLVariables;
import flashnet.URLRequest;

InteractiveObject(theName.getChildAt(1)).tabIndex = 1;
InteractiveObject(theEmail.getChildAt(1)).tabIndex = 2;
InteractiveObject(theMessage.getChildAt(1)).tabIndex = 3;


send_btn.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_7);

function fl_MouseClickHandler_7(event:MouseEvent):void
{

if (theName.text == "" || theEmail.text == "" || theMessage.text == "")
{
theFeedback.text = "Please fill out all fields.";
}
else
{
// create a variable container
var allVars:URLVariables = new URLVariables();
allVarsname = theName.text;
allVarsemail = theEmail.text;
allVarsmessage = theMessage.text;
//Send info to a url
var mailAddress:URLRequest = new URLRequest("http://mydomain/contact.php");
mailAddress.data = allVars;
mailAddress.method = URLRequestMethod.POST;
sendToURL(mailAddress);
theFeedback.text = "Thank you!";
theName.text = "";
theEmail.text = "";
theMessage.text = "";
}
}

So my question is how do I integrate the contact php code into my as3 code?


Any advice would be greatly appreciated, there is free music if anybody can help me out!

Big thanks to all

Jake
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23456
  • Loc: Woodbridge VA

Post 3+ Months Ago

Match the variable names in the php script. The variables the script is expecting are, Name, Email, Tel, and Message. You can either alter the php script to match your variable names or vice versa.
  • jakecusack
  • Born
  • Born
  • jakecusack
  • Posts: 2

Post 3+ Months Ago

Many thanks fella, i will give it ago this evening
  • DEVNEB
  • Newbie
  • Newbie
  • User avatar
  • Posts: 9
  • Loc: Quebec

Post 3+ Months Ago

I just saw this in your code:

Code: [ Select ]
allVarsname = theName.text;
allVarsemail = theEmail.text;
allVarsmessage = theMessage.text;
  1. allVarsname = theName.text;
  2. allVarsemail = theEmail.text;
  3. allVarsmessage = theMessage.text;


It would be correct like this (like ATNO/TW already said it):

Code: [ Select ]
allVars(dot)Name = theName.text;
allVars(dot)Email = theEmail.text;
allVars(dot)Message = theMessage.text;
  1. allVars(dot)Name = theName.text;
  2. allVars(dot)Email = theEmail.text;
  3. allVars(dot)Message = theMessage.text;


Where (dot) is a "." (I do not understand why this forum restricts me from writting url, even more since it is not an url :evil: )


Your question was
Quote:
how do I integrate the contact php code into my as3 code?


You cannot integrate the php code into as3 code, as you asked it. Following your example, the php code must be written in this file : http://mydomain/contact.php

Maybe you already understood it, but your question seems confused about that point.

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: No registered users and 5 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.