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.
Action Script Code:
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 Code:
[LEFT] [COLOR=#000000] [COLOR=#0000bb]<?php
$emailPattern [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#dd0000]'/^[^@\s]+@([-a-z0-9]+\.)+[a-z]{2,}$/i'[/COLOR][COLOR=#007700];
[/COLOR][COLOR=#0000bb]$to [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#dd0000]"fake@email.com"[/COLOR][COLOR=#007700];
[/COLOR][COLOR=#0000bb]$subject [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#dd0000]'hi'[/COLOR][COLOR=#007700];
[/COLOR][COLOR=#0000bb]$from [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#dd0000]'bleh'[/COLOR][COLOR=#007700];
[/COLOR][COLOR=#0000bb]$name_text [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000bb]safe [/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000bb]stripslashes[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000bb]$_POST[/COLOR][COLOR=#007700][[/COLOR][COLOR=#dd0000]'name_text'[/COLOR][COLOR=#007700]]) );
[/COLOR][COLOR=#0000bb]$email_text [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000bb]safe[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000bb]$_POST[/COLOR][COLOR=#007700][[/COLOR][COLOR=#dd0000]'email_text'[/COLOR][COLOR=#007700]] );
[/COLOR][COLOR=#0000bb]$phone_text [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000bb]safe[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000bb]$_POST[/COLOR][COLOR=#007700][[/COLOR][COLOR=#dd0000]'phone_text'[/COLOR][COLOR=#007700]] );
[/COLOR][COLOR=#0000bb]$subject_text [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000bb]safe[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000bb]$_POST[/COLOR][COLOR=#007700][[/COLOR][COLOR=#dd0000]'subject_text'[/COLOR][COLOR=#007700]] );
[/COLOR][COLOR=#0000bb]$comment_text [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000bb]safe[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000bb]stripslashes[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000bb]$_POST[/COLOR][COLOR=#007700][[/COLOR][COLOR=#dd0000]'comment_text'[/COLOR][COLOR=#007700]]) );
[/COLOR][COLOR=#0000bb]$headers [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#dd0000]"From: "[/COLOR][COLOR=#007700]. [/COLOR][COLOR=#0000bb]$from [/COLOR][COLOR=#007700]. [/COLOR][COLOR=#dd0000]"<" [/COLOR][COLOR=#007700]. [/COLOR][COLOR=#0000bb]$to[/COLOR][COLOR=#007700]. [/COLOR][COLOR=#dd0000]">
"[/COLOR][COLOR=#007700];
[/COLOR][COLOR=#0000bb]$headers [/COLOR][COLOR=#007700].= [/COLOR][COLOR=#dd0000]“Reply-To: " [/COLOR][COLOR=#007700]. [/COLOR][COLOR=#0000bb]$email_text [/COLOR][COLOR=#007700]. [/COLOR][COLOR=#dd0000]”
"[/COLOR][COLOR=#007700];
[/COLOR][COLOR=#0000bb]$headers [/COLOR][COLOR=#007700].= [/COLOR][COLOR=#dd0000]"Return-path: "[/COLOR][COLOR=#007700]. [/COLOR][COLOR=#0000bb]$email_text[/COLOR][COLOR=#007700];
[/COLOR][COLOR=#0000bb]$message [/COLOR][COLOR=#007700].= [/COLOR][COLOR=#dd0000]"Name: " [/COLOR][COLOR=#007700]. [/COLOR][COLOR=#0000bb]$name_text [/COLOR][COLOR=#007700]. [/COLOR][COLOR=#dd0000]"
"[/COLOR][COLOR=#007700];
[/COLOR][COLOR=#0000bb]$message [/COLOR][COLOR=#007700].= [/COLOR][COLOR=#dd0000]“Email: " [/COLOR][COLOR=#007700]. [/COLOR][COLOR=#0000bb]$email_text [/COLOR][COLOR=#007700]. [/COLOR][COLOR=#dd0000]”
"[/COLOR][COLOR=#007700];
[/COLOR][COLOR=#0000bb]$message [/COLOR][COLOR=#007700].= [/COLOR][COLOR=#dd0000]“Phone Number: " [/COLOR][COLOR=#007700]. [/COLOR][COLOR=#0000bb]$phone_text [/COLOR][COLOR=#007700]. [/COLOR][COLOR=#dd0000]”
"[/COLOR][COLOR=#007700];
[/COLOR][COLOR=#0000bb]$message [/COLOR][COLOR=#007700].= [/COLOR][COLOR=#dd0000]“Inquiries: " [/COLOR][COLOR=#007700]. [/COLOR][COLOR=#0000bb]$subject_text [/COLOR][COLOR=#007700]. [/COLOR][COLOR=#dd0000]”
"[/COLOR][COLOR=#007700];
[/COLOR][COLOR=#0000bb]$message [/COLOR][COLOR=#007700].= [/COLOR][COLOR=#dd0000]“Comments: " [/COLOR][COLOR=#007700]. [/COLOR][COLOR=#0000bb]$comment_text [/COLOR][COLOR=#007700]. [/COLOR][COLOR=#dd0000]”
"[/COLOR][COLOR=#007700];
if ([/COLOR][COLOR=#0000bb]count[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000bb]$errors[/COLOR][COLOR=#007700]) < [/COLOR][COLOR=#0000bb]1[/COLOR][COLOR=#007700]){
[/COLOR][COLOR=#0000bb]mail[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000bb]$to[/COLOR][COLOR=#007700],[/COLOR][COLOR=#0000bb]$subject[/COLOR][COLOR=#007700],[/COLOR][COLOR=#0000bb]$message[/COLOR][COLOR=#007700],[/COLOR][COLOR=#0000bb]$headers[/COLOR][COLOR=#007700]);
echo [/COLOR][COLOR=#dd0000]"var1=yes&successMessage=Thank you so much for your Inquiry. I'm looking forward in serving you soon!"[/COLOR][COLOR=#007700];
function [/COLOR][COLOR=#0000bb]safe[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000bb]$string[/COLOR][COLOR=#007700])
{
[/COLOR][COLOR=#007700]
return [/COLOR][COLOR=#0000bb]preg_replace[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000bb]$pattern[/COLOR][COLOR=#007700], [/COLOR][COLOR=#dd0000]''[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000bb]$string[/COLOR][COLOR=#007700]);
}
[/COLOR][COLOR=#0000bb]?>[/COLOR] [/COLOR] [/LEFT]
What am I doing wrong? Much Appreciated in advanced!