Encapsulating the code into three functions will make it easier to debug,
try this:
//Begin ActionScript:
on(release){
doCheck();
}
function doCheck(){
if(fullName_txt.text != "" && email_txt.text != "" && emailMessage_txt.text
!= "") {
doSendLoad();
} else {
gotoAndStop("error");
}
}
function doSendLoad(){
var mysend_lv:LoadVars = new LoadVars();
var myload_lv:LoadVars = new LoadVars();
mysend_lv.fullName = fullName_txt.text;
mysend_lv.email = email_txt.text;
mysend_lv.emailMessage = emailMessage_txt.text;
myload_lv.onLoad = function(success) {
if(success){
if(this.nResult == "Fail"){ //here "this" refers to myload_lv, I used
"nResult" so as not to muddy up a Flash keyword
gotoAndStop("error");
} else {
//you could also load in more info here using "this.someOtherVar1"
or "this.someOtherVar2" (see below)
gotoAndStop("success");
}
}
}
mysend_lv.sendAndLoad("contact.php", myload_lv, "POST"); //you have to use
sendAndLoad if you want to receive info
}//end ActionScript
//Begin PHP:
//do the database hookup
//do the database query
//if the query fails
print("&nResult=Fail");
exit;
//if the query is a success, you could send more info back
$moreInfo1 = someQueriedInfo1;
$moreInfo2 = someQueriedInfo2;
print("&nResult=OK&someOtherVar1=$moreInfo1&someOtherVar2=$moreInfo2");
//etc....
exit;
//end PHP
//It can be frustrating to get this working the first time, but this should
point you in the right direction.
richard
[quoted text, click to view] "Motion Maker" <macromedia@osfordusahay.com> wrote in message
news:e5kf9a$7on$1@forums.macromedia.com...
> Sounds like the PHP contact.php is sending back whitespace (tabs, spaces,
> returns), text or html.
>
> --
> Lon Hosford
>
www.lonhosford.com > May many happy bits flow your way!
> "yself" <webforumsuser@macromedia.com> wrote in message
> news:e57l4g$cma$1@forums.macromedia.com...
> My contact form works just fine, however, I currently have the target set
to
> "_blank" which is not what I want.
>
> Rather than opening the .php file open in a new window, I just want to go
> to a
> new frame (labeled "success" or "error") within my flash file (which
> currently
> works fine)
>
> So, my question is how do I send the form information to my php file
> WITHOUT
> having to open a new window outside of my flash file since I'm sending the
> user
> to new frame instead.
>
> FYI: I've already tried removing "_blank" but it still opens the php file
> in a
> new browser window.
>
> My code below:
>
> on (release){
> var my_lv:LoadVars = new LoadVars();
>
> my_lv.fullName = fullName_txt.text;
> my_lv.email = email_txt.text;
> my_lv.emailMessage = emailMessage_txt.text;
>
> if(fullName_txt.text != "" && email_txt.text != "" &&
> emailMessage_txt.text
> != "") {
> my_lv.send("contact.php","_blank","POST");
> gotoAndStop("success");
> }
> else {
> gotoAndStop("error");
> }
> }
>
> Any help is greatly appreciated.
>
> Yvonne
>
>