This content has been marked as final. Show 7 replies
well i found one problem. my AS was using the post method while my php was looking via for get. so i fixed that, my AS is now using the get method and the data is transferred into the database. it actually looks like it working now....
however, i'm still getting a unsuccessful serverResponse because my dynamic text field displays "there has been an error submitting your request". what's wrong?
I'm no php expert, but I can't see a print or echo there for a response to be returned to flash.
seems unusual (at least to me, coming from an actionscript world, anyway) because its not inside a function. I checked the php docs and its legal in global scope but does this:
"If called from the global scope, then execution of the current script file is ended..."
So its possible your
is not executing as well.
I think you need to print or echo something (e.g. "&result=OK&") instead of using the return.
well you can't say it's not healthy to talk to yourself. i don't know what it is about posting, it makes me get the answer, whether from my own head or someone else's.
anyweezer, i was using sendAndLoad, which sends data to my php, but also expects a response. if it doesn't get a response, flash is going to assume it's communication attempt was unsuccessful. the problem was in my php, it wasn't giving any kind of response for flash to read. if i add...
it works just fine. i could put anything really, but i decided to create a variable that would fit the syntax of the surrounding code and use it in flash in an if statement.
ha ha, we posted at the same time :)
Yep. Great to see you got it sorted. I'm curious about the return statement though? What do you think?
you know i'm not sure really. before when i posted i put my echo statement after the return. that change made it register in flash because it was now getting a response from the server, so i guess the return didn't end the execution of the script file (as php.net says it does).
i am taking the return statement out, the only reason it was in there was because i copied, pasted and edited previously used code of mine (i play with too many different languages... i have to do that). after i took out the return the only difference i can see is that bringing up the file in a browser directly, it displays "allocationSubmitted=true", whereas before it didn't display anything.
it still gets me to wonder though, how does that echo statement work after that return statement?
I don't know about the php return statement. I just checked the php docs as well and that's why I asked. It wouldn't be the first time some docs incorrectly described the behaviour of a programming language or perhaps its not behaving as documented because it has a return value associated.
Either way , were it me, I would remove it too, I can't see it doing anything useful in that context.