Okay, there is something that I don’t quite understand. I built a flash contact form in Flash CS4 and embedded the swf in my webpage using Dreamweaver CS4. I upload the files in my server but why it’s not working? I created a test folder in my folder and it does work…
(It doesn’t work here)
http://www.rodriguezstudios.com/atko…g/contact.html
(But it works here)
http://www.rodriguezstudios.com/testat/
The problem is that I’m not receiving the information when the user enters and submits the information on the contact form. I do receive the information on the test link. I’m posting the Flash AS and PHP Code to see if anyone can point out any mistake that I’m doing.
submitButton.addEventListener(MouseEvent.MOUSE_UP, sendForm);
function sendForm(event:MouseEvent):void {
if (commentBox.text=="") {
submitMessages.text="You must enter a comment";
} else if (emailBox.text.indexOf("@") == -1 || emailBox.text.indexOf(".") == -1 ) {
submitMessages.text="You must enter an email address";
} else {
submitToPHP();
}
}
function submitToPHP() {
if (subject_text==null) {
subject_text=="No Subject provide";
}
var variables:URLVariables = new URLVariables();
var request:URLRequest = new URLRequest();
request.url="atkost-flash.php";
request.method=URLRequestMethod.POST;
request.data = variables;
variables.name_text = nameBox.text;
variables.email_text = emailBox.text;
variables.phone_text = phoneBox.text;
variables.comment_text = commentBox.text;//name_text must match php code
variables.subject_text = subject_text;
var loader:URLLoader = new URLLoader();
loader.dataFormat=URLLoaderDataFormat.VARIABLES;
loader.addEventListener(Event.COMPLETE, completeHandler);
try {
loader.load(request);
submitMessages.text="Your message is sending to At-Kost Flooring...";
} catch (error:Error) {
submitMessages.text="Unable to send form";
}
function completeHandler(event:Event):void {
submitMessages.text=event.target.data.successMessage;
so.clear();
nameBox.text="";
emailBox.text="";
phoneBox.text="";
commentBox.text="";
selectionBox.selectedIndex=-1;
}
}
<?php
$emailPattern = '/^[^@\s]+@([-a-z0-9]+\.)+[a-z]{2,}$/i';
$to = "fake@email.com";
$subject = 'hi';
$from = 'bleh';
$name_text = safe (stripslashes($_POST['name_text']) );
$email_text = safe($_POST['email_text'] );
$phone_text = safe($_POST['phone_text'] );
$subject_text = safe($_POST['subject_text'] );
$comment_text = safe(stripslashes($_POST['comment_text']) );
$headers = "From: ". $from . "<" . $to. ">
";
$headers .= "Reply-To: " . $email_text . "
";
$headers .= "Return-path: ". $email_text;
$message .= "Name: " . $name_text . "
";
$message .= "Email: " . $email_text . "
";
$message .= "Phone Number: " . $phone_text . "
";
$message .= "Inquiries: " . $subject_text . "
";
$message .= "Comments: " . $comment_text . "
";
if (count($errors) < 1){
mail($to,$subject,$message,$headers);
echo "var1=yes&successMessage=Thank you so much for your Inquiry. I'm looking forward in serving you soon!";
function safe($string)
{
$pattern = "/\r|
|\%0a|\%0d|Content\-Type:|bcc:|to:|cc:/i";
return preg_replace($pattern, '', $string);
}
?>
What am I doing wrong? Much Appreciated in advanced!