I need a bit of PHP coding help! PHP + ActionScript 3.0?

  • Thread starter Thread starter John M
  • Start date Start date
J

John M

Guest
Can someone help me with PHP?

I'm working on a tutorial Flash/ActionScript 3.0 website that includes a contact form that intergrates with PHP. I'm not familiar with PHP and even though my contact form says "Sending Complete", I'm not getting any emails in my inbox. I'm using the email that I always use, so I know that it will receive emails. The email account I use is on the same domain as the mock webpage.

I use Easyspace for hosting, and I know they support PHP because I got this to work:
http://www.alpha-duplication.com/website/phpinfo.php

My fake website is at http://www.alpha-duplication.com/website/ and you can see the contact form under the Contact section.

Easyspace (the web host) has this article in their FAQ, but I'm not too sure how to add it to my code to make it work. https://support.easyspace.com/faq.php?do=article&articleid=1811


============================================
Using the tutorial from LearnFlash.com, I've just copied exactly what the teacher types. Here is the PHP code from the tutorial:
<?php

$sendto = '[email protected]';
$subject = 'Email from TestWebsite.com Contact Form';
$name = $_POST['fromname'];
$from = $_POST['fromemail'];
$message = $_POST['frommessage'];
$message = stripslashes($message);

$content = "Name: " . $name . "\n";
$content .= "Email: " . $from . "\n\n";
$content .= $message;

if(mail($sendto,$subject,$content))
{
echo 'response=passed';
}
else
{
echo 'response=failed';
}

?>

==============================================
Here is the ActionScript 3.0 Code:

send_btn.addEventListener(MouseEvent.CLICK, submit);

function submit(e:MouseEvent):void {
var variables:URLVariables = new URLVariables();
variables.fromname = name_txt.text;
variables.fromemail = email_txt.text;
variables.frommessage = message_txt.text;

var req:URLRequest = new URLRequest("contact.php");
req.data = variables;
req.method = URLRequestMethod.POST;

var loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
loader.addEventListener(Event.COMPLETE, sent);
loader.addEventListener(IOErrorEvent.IO_ERROR, error);
loader.load(req);
status_txt.text = "Sending...";
}

function sent(e:Event):void {
status_txt.text = "You're email has been sent!";
name_txt.text = "";
email_txt.text = "";
message_txt.text = "";
}

function error(e:IOErrorEvent):void {
status_txt.text = "There was an error. Please try again later.";
}
==============================================
Any ideas?
Every website asset is in the same directory. I'd appreciate any help to get my contact.php form working and like I said above, I'm not very familiar with PHP, actually this is my first exposure to it. I'm hoping to intergrate this to my new webpage because we would like a few different forms and the Flash background will let me design it however I wish.


Many, many thanks!
 
Back
Top