Flash Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignFlash Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 27th, 2004, 10:35 AM
Rob B Rob B is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Location: Ottawa
Posts: 23 Rob B User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
flash and email

Hello I'm having problems with a flash form sending an email via php. The thing is it all works except for the part in php that sends a message back to flash saying the message has been mailed.

In my actionscript I have:
this.userData = new LoadVars();
this.userData.FormatChk1 = FormatChk1.getValue();
this.userData.Name = Name;
this.userData.Email = Email;
this.userData.sendAnswer ="sending your message, please wait";
EmailStatus = this.userData.sendAnswer;
var mailServer = "email.php";
this.userData.sendAndLoad(mailServer, userData, "POST");

// look for variables named send_answer and print it
EmailStatus = String(this.userData.sendAnswer);

In PHP I have the following:
$sendresult = "thank you for your interest. You will receive a confrimation email shortly";
$sendAnswer = "answer=";
$sendAnswer .= $sendresult;
echo "&$sendAnswer";
//print "sendAnswer=".urlencode($sendAnswer);

Reply With Quote
  #2  
Old January 27th, 2004, 12:40 PM
caguru's Avatar
caguru caguru is offline
<insert title here>
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Location: at home
Posts: 405 caguru User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 29 m 59 sec
Reputation Power: 8
First you should uncomment the print line (remove the //), second remove the echo line. The first var Flash receives should not have an ampersand (&) leading into it.

Second make sure that your message is the first thing being sent. In your flash debugger you should see the data being returned somewhere even if it is not loading where you expected it too ( even though your syntax looks correct from here) Looking for leading whitespace and what not.

If these don't work, post again with more details such as what is being returned in the debugger Vars window such as userData.

Good luck
__________________
--the key to life is avoiding death--

Reply With Quote
  #3  
Old January 27th, 2004, 02:49 PM
Rob B Rob B is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Location: Ottawa
Posts: 23 Rob B User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
still not working

Well its still not working. I don't know what's wrong. Maybe someon can take a look at it and let me know I forgot a ; or have some white spacesomewhere or f'd it up good and where this is.

I can only upload the php file so here's the actionscript:
on (release)
{
// First we validate all variable and write the error message
if (!FormatChk1.getValue(false)&& !FormatChk2.getValue(false))
{
EmailStatus = "ENTER VIDEO FORMAT";
}

else if (!ReelChk1.getValue(false) && !ReelChk2.getValue(false) && !ReelChk3.getValue(false) && !ReelChk4.getValue(false) && !ReelChk5.getValue(false) && !ReelChk6.getValue(false) && !ReelChk7.getValue(false))
{
EmailStatus = "ENTER REEL";
}

else if (!Name.length)
{
EmailStatus = "ENTER NAME";
}

else if (email.indexOf(" ") != -1 || email.indexOf("@") == -1 || email.indexOf(".") == -1 || email.length<6 || email.lastIndexOf(".")<email.indexOf("@"))
{
EmailStatus = "INVALID EMAIL";
}

else if (!Phone.length)
{
EmailStatus = "ENTER PHONE NUMBER";
}

else if (!Company.length)
{
EmailStatus = "ENTER COMPANY NAME";
}

else if (!Address.length)
{
EmailStatus = "ENTER ADDRESS";
}

else if (!City.length)
{
EmailStatus = "ENTER CITY";
}

else if (!Province.length)
{
EmailStatus = "ENTER PROVINCE/STATE";
}

else if (!Postal.length)
{
EmailStatus = "ENTER POSTAL/ZIP CODE";
}
else
{
this.userData = new LoadVars();
this.userData.FormatChk1 = FormatChk1.getValue();
this.userData.FormatChk2 = FormatChk2.getValue();
this.userData.ReelChk1 = ReelChk1.getValue();
this.userData.ReelChk2 = ReelChk2.getValue();
this.userData.ReelChk3 = ReelChk3.getValue();
this.userData.ReelChk4 = ReelChk4.getValue();
this.userData.ReelChk5 = ReelChk5.getValue();
this.userData.ReelChk6 = ReelChk6.getValue();
this.userData.ReelChk7 = ReelChk7.getValue();
this.userData.Name = Name;
this.userData.Email = Email;
this.userData.Company = Company;
this.userData.Address = Address;
this.userData.City = City;
this.userData.Province = Province;
this.userData.Postal = Postal;
this.userData.Additional = Additional;
this.userData.Additional = "sending mail";

var mailServer = "email.php";
//this.userData.sendAndLoad(mailServer,userData, "POST");
//this.userData.sendAndLoad(mailserver, this, "POST");
//this.userData.loadVariablesNum(mailserver, this, "POST");
getURL (mailserver, userdata, "POST");

// look for variables named send_answer and print it
// Status of message
EmailStatus = this.userdata.sendAnswer;
//EmailStatus = "Your requst has been sent, you should receive an email confirming your request shortly";
}// end of else
}// end of script
Attached Files
File Type: php email2.php (4.4 KB, 204 views)

Reply With Quote
  #4  
Old January 27th, 2004, 03:12 PM
caguru's Avatar
caguru caguru is offline
<insert title here>
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Location: at home
Posts: 405 caguru User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 29 m 59 sec
Reputation Power: 8
there's two immediate problems with the php script in the last few lines of code.

1.Change this
PHP Code:
 $sendAnswer "&sendAnswer="
to
PHP Code:
 $sendAnswer "sendAnswer="
The reason being is that the first var sent to flash CANNOT have a & symbol in front of it. So you need to remove the &.

2.Change this
PHP Code:
print "$sendAnswer="
to
PHP Code:
print "$sendAnswer"
You need to remove the equal siqn because it was already added to the string on the other line above that was just changed.

Valid Flash format goes like this:
varName1=my data here&varName2=more data here

what you have now does this:
&varName1=my data here&varName2=more data here=
Notice the beginning & symbol and the trailing = sign.

To really get the full scope you should run Ctrl>Debug Movie. In the variables window, you will find your data being returned from php inside the movie clip that requested it (unless you specify a different target). see if you can find your message "thank you for your interest...." If so, see what var name it is loading under.

Reply With Quote
  #5  
Old January 27th, 2004, 04:07 PM
Rob B Rob B is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Location: Ottawa
Posts: 23 Rob B User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
okay the error then is in my actionscript because what I'm gettting under vaiables is under the submit I get all the code in my email.php file

I don't get a variable = to the "thank you " message.

Further down where I call the value of the thank you message from the LoadVars it says the value is undefined.

So it seems to me that it's not running the php script and so php isn't sending back the variables.

Do you mind taking another look at it?

Thanks

Reply With Quote
  #6  
Old January 28th, 2004, 01:21 AM
rynoe's Avatar
rynoe rynoe is offline
_root.troubleMaker
Dev Shed Novice (500 - 999 posts)
 
Join Date: Dec 2003
Location: Florida, USA
Posts: 638 rynoe User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 8 m 30 sec
Reputation Power: 5
//this.userData.sendAndLoad(mailServer,userData, "POST");
//this.userData.sendAndLoad(mailserver, this, "POST");
//this.userData.loadVariablesNum(mailserver, this, "POST");


Can I ask, what is the purpose of this code?

Reply With Quote
  #7  
Old January 28th, 2004, 08:13 AM
Rob B Rob B is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Location: Ottawa
Posts: 23 Rob B User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Sure,
These were teh various methods I was experimenting with to pass the variables to the php script. getURL isn't the one I want to use because it will open up a new window for email.php. I want it to run seemlessly inthe background so I was using the above commands. For testing though I used getURL because it will display the variables I want.

However the final script uses the first sendAndLoad, and its here that I'm having problems. WHen I run the debugger and see the variables I don't see the ouput from my php file but my entire php script.

the place where it outputs the variables passed to flash is still undefined.

Reply With Quote
  #8  
Old January 28th, 2004, 01:23 PM
Rob B Rob B is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Location: Ottawa
Posts: 23 Rob B User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
OK , I've looked at it some more and in my actionscript I've added this line after my sendAndLoad this.userData.onLoad = function(success) {
EmailStatus.text = userData.sendAnswer;
}
Now the load section isn't undefined but I still can't call up the variable in PHP that gives teh mail sent message. When I put a trace statement in front of it it's sending it all the variable to the mail file. When I put it inside the load function I don't get any response. Any ideas?

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignFlash Help > flash and email


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway