coogie Posted March 2, 2008 Share Posted March 2, 2008 Hello there, i've struggled with this for a week now and simply cannot identify the problem. I have a simple email form in flash cs3 and 2 php scripts. For some reason, i am getting this error in flash "Error #2101: The String passed to URLVariables.decode() must be a URL-encoded query string containing name/value pairs". I'm pretty sure it is not an error in my flash, because i've used the exact some code with another php script and it works. Here is my php. Please help me find an error in it? feedback.php <?php //@require_once ('database.php'); @require_once ('function.php'); if(isset($_POST['varEmail']) && isset($_POST['varMessage'])) { if(isValidatedEmail($_POST['varEmail'])) { if(feedbackform($_POST['varEmail'], $_POST['varMessage'])) { echo "feedback=success"; } else { echo "feedback=failed"; } } else { echo "feedback=invalidemail"; } } ?> inside function.php function isValidatedEmail($email) { if (!ereg("[^@]{1,64}@[^@]{1,255}", $email)) { return false; } $email_array = explode("@", $email); $local_array = explode(".", $email_array[0]); for ($i = 0; $i < sizeof($local_array); $i++) { if (!ereg("^(([a-za-z0-9!#$%&*+/=?^_`{|}~-][a-za-z0-9!#$%&*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i])) { return false; } } if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) { $domain_array = explode(".", $email_array[1]); if (sizeof($domain_array) < 2) { return false; } for ($i = 0; $i < sizeof($domain_array); $i++) { if (!ereg("^(([a-za-z0-9][a-za-z0-9-]{0,61}[a-za-z0-9])|([a-za-z0-9]+))$", $domain_array[$i])) { return false; } } } return true; } function feedbackform($email, $message) { $to = "email@email.com"; $subject = "From ".$email; $sent = mail($to, $subject); if($sent) { return 1; } else { return 0; } } thank you for any help ! Quote Link to comment Share on other sites More sharing options...
coogie Posted March 2, 2008 Author Share Posted March 2, 2008 I know its not a flash forum but thought i'd post my flash function that calls the script function contact():void { var theVariables:URLVariables = new URLVariables(); theVariables.varEmail = email.text; theVariables.varMessage = commentstxt.text; var theRequest:URLRequest = new URLRequest(); theRequest.url = "feedback.php"; theRequest.method = URLRequestMethod.POST; theRequest.data = theVariables; var theLoader:URLLoader = new URLLoader(); theLoader.dataFormat = URLLoaderDataFormat.VARIABLES; theLoader.addEventListener(Event.COMPLETE, loadCompleteHandler); theLoader.addEventListener(IOErrorEvent.IO_ERROR, handleIOError); theLoader.load(theRequest); function handleIOError(event:IOErrorEvent):void { event.target.removeEventListener(IOErrorEvent.IO_ERROR, handleIOError); } function loadCompleteHandler(event:Event):void { switch(event.target.data.feedback) { case "success": howmuch.text = "Sent successfully" initialContact(); break; case "invalidemail": howmuch.text = "Please use a valid email address."; break; case "failed": howmuch.text = "Error sending" break; default: return; } } } Quote Link to comment Share on other sites More sharing options...
coogie Posted March 4, 2008 Author Share Posted March 4, 2008 I still cannot find the error with my code... please someone take a look! Quote Link to comment Share on other sites More sharing options...
coogie Posted March 7, 2008 Author Share Posted March 7, 2008 Hi, i'm sorry to move the message up again but I can't solve my problem yet i know it's such a small error ive made Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.