Possible error accepting variables

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
junestag
Forum Commoner
Posts: 39
Joined: Tue Sep 18, 2007 5:14 pm
Location: Alaska
Contact:

Possible error accepting variables

Post by junestag »

Output page in PHP not working when variables sent to it from Flash module. I have a PHP script that processes and spits out a bunch of text for users when they click a submit button in a Flash SWF file. I setup a test form that sends the variables to the PHP file and it outputs correctly, but when I try and submit it from flash the php file doesn't even load...although both the SWF and the php file are on the same directory on the server. I'm thinking this is an error in my actionscript code, or a security issue on the server, but I wanted to get your guys opinions on my php code first. Is it correct to accept the variables from Flash using the following test?

Code: Select all

<?php

if (($_POST['c1'] == "") || ($_POST['c2'] == "") || ($_POST['c3'] == "") || ($_POST['c4'] == "") || ($_POST['c5'] == "") || ($_POST['c6'] == "") || ($_POST['c7'] == "") || ($_POST['l1'] == "") || ($_POST['l2'] == "") || ($_POST['l3'] == "") || ($_POST['l4'] == "") || ($_POST['l5'] == "") || ($_POST['a1'] == "") || ($_POST['a2'] == "") || ($_POST['a3'] == "") || ($_POST['a4'] == "") || ($_POST['a5'] == "") || ($_POST['r1'] == "") || ($_POST['r2'] == "") || ($_POST['r3'] == "") || ($_POST['r4'] == "") || ($_POST['le1'] == "") || ($_POST['le2'] == "") || ($_POST['le3'] == "") || ($_POST['le4'] == "") || ($_POST['ct1'] == "") || ($_POST['ct2'] == "") || ($_POST['ct3'] == "") || ($_POST['ct4'] == "") || ($_POST['ct5'] == "") || ($_POST['ct6'] == "") || ($_POST['ct7'] == "") || ($_POST['ls1'] == "") || ($_POST['ls2'] == "") || ($_POST['ls3'] == "") || ($_POST['ls4'] == "") || ($_POST['ac1'] == "") || ($_POST['ac2'] == "") || ($_POST['ac3'] == "") || ($_POST['ac4'] == "")) {

?>

<p>Please answer all the questions before submitting. Return to the module, answer the questions you missed, and re-submit. Thank you.</p><br /><br /></div>

<?php

} else {
//a bunch more code utilizing the $_POST variables...
nshiell
Forum Newbie
Posts: 12
Joined: Mon Oct 19, 2009 12:20 pm

Re: Possible error accepting variables

Post by nshiell »

Well, if an HTML form works OK then that would point to your SWF
What I would do is alter your PHP code to save all the raw input request data to a file.
Run the script with the form and then run it with you Flash and compare the input
If it's a security issue then you will not get the second file created!
If it's bad data (IN EITHER THE FORM OR SWF!) you should be able to debug by comparing the input
Then if that's OK check your SWF is handling the returned data OK
junestag
Forum Commoner
Posts: 39
Joined: Tue Sep 18, 2007 5:14 pm
Location: Alaska
Contact:

Re: Possible error accepting variables

Post by junestag »

Awesome, that totally worked! Both the test form and my flash file created the vars.txt file I wanted..now i just need to figure out how to get flash to actually send the user to that php file so they can see their results; right now it sends the variables to php but it looks to the user like they are just sitting uselessly on the flash page :p
junestag
Forum Commoner
Posts: 39
Joined: Tue Sep 18, 2007 5:14 pm
Location: Alaska
Contact:

Re: Possible error accepting variables

Post by junestag »

Turns out I just had to change my code to the following in ActionScript 3:

navigateToURL(scriptRequest2);

thanks for you help nshiell your advice really helped me troubleshoot the problem!
Post Reply