PDA

View Full Version : Flash php contact form not working...



smallwoo
04-12-2008, 07:07 PM
I created a flash form to go with my flash site. When I press the submit button it takes me to the "your email is sent" page in my movie clip, but I don't receive an email. I found the code for my form online. I'm not sure if my flash button is effectively communicating with my php file. I've read so many tutorials and I'm running out of ideas. I wanted to know if someone would be so kind as to take a look at my script to see if I'm missing something.

My PHP script:


<?php

$name = $_POST['name'] ;
$email = $_POST['email'] ;
$subject = $_POST ['subject'] ;
$message = $_POST['message'] ;


$recipient = "xxxxxxxxxxxx@smallwoodart.com" ;

$subject = "websiterol" . $email;
$headers = "From:" . $Name . " <" . $email . ">\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' ;

$content = "<html><head><title>Contact form</title></head><body><br>" ;

$content .= "name <b>" . $name . "</b><br>" ;
$content .= "subject <b>" . $subject . "</b><br>" ;
$content .= "email <b>" . $email . "</b><br><hr><br>" ;
$content .= $message ;
$content .= "<br></body></html>" ;

mail($recipient,$subject,$content,$headers);


?>


My Flash button Action Script:


on (release) {
_parent.loadVariablesNum("form.php","0","POST");
_parent.name="Your Name:";
_parent.subject="Your Subject:";
_parent.email="Your Email:";
_parent.message="Your Message:";
gotoAndStop(11);
}


Any help will be greatly appreciated.

**my email is omitted for privacy reasons.

linFox
04-12-2008, 08:07 PM
It may be that you've capitalised the $name variable on the first $headers line.
PHP variables are case-sensitive and depending on your configuration, either an error will halt the script there due to the undefined variable or, the script will try to continue but the email will not sent due to the malformed From header.

So, just change $Name to $name and see if it gets it working.

smallwoo
04-13-2008, 01:29 PM
Thanks for your response. I changed $Name to $name as you stated and it's still not working. Could the problem be with the Action Script for my button?

Seb
04-14-2008, 03:33 AM
What you can do is to skip the flash form, populate your variables, and try to run the PHP script manually and see if it even sends a mail at all.