PDA

View Full Version : onClipEvent(data) - checking variable from PHP


monkeybrainz
05-29-2003, 12:17 AM
hey guys i'm really stumped -
in my movie the user submits a form to PHP, which validates the form, and if all's cool it emails me.

i'm trying to give the user a message depending on what PHP returns but am having a miserable time figuring out where that passed variable is...

attached to my movie, view_contact_form, is:
onClipEvent(data){
gotoAndPlay("loadcomplete");
}
inside the movie,view_contact_form, on the frame "loadcomplete" is:

if (message=="m1"){ // all is ok
play();
}

if (message=="m3"){ // invalid email
this.attachMovie("error_box", "error_box5", 25);
this.error_box5._x = -40;
this.error_box5._y = -5;
error_box5.error_msg = "Invalid email address";
stop();
}
to submit the form:
on (release){
if (some error trapping here){

} else {
loadVariables("question.php", this);
}
}
message is the variable returned from PHP and appears just fine in the dynamic text box i have sitting on on the view_contact_form timeline after i submit the form, but i can't seem to check it with my "if " statements. i tried putting the
"if (message=="m1...." inside the onClipEvent(data){ but that didn't work either.

any help would really be appreciated!!
i'm using flash 5 btw

JHallam
05-29-2003, 12:30 AM
Ok, create a function with the .data and stick you variables in and check them...done!

monkeybrainz
05-29-2003, 02:38 AM
hey GRaPHiX_FReaK - that's the odd thing, i can't seem to get at the variable! it appears in the OHHH!!! SOAB!@#$ there was a space at the end of the variable passed from PHP so no wonder it didn't show in the text box :rolleyes:
<dolt says>maybe i'll should take up knitting instead</dolt>

thanks anyway :D

JHallam
05-29-2003, 11:43 AM
Oh dear oh dear! lol Glad your eagle eye picked the problem! ;)

tg
05-29-2003, 03:02 PM
when you have flash read in variables for text files, it is always a good idea to put an '&' at the end of each value to return... it trims off all whitespace for your values.

monkeybrainz
05-29-2003, 03:14 PM
really?...hmmmmm thanks for the tip! and i also should have used [b]trim()[/]- all form variables passed to the server to keep perplexing problems like that from happening in the first place