Welcome to Dream.In.Code
Getting Help is Easy!

Join 118,589 Programmers for FREE! Ask your question and get quick answers from experts. There are 822 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



sendAndLoad "undefined"

 
Reply to this topicStart new topic

sendAndLoad "undefined", Writing from Flash to database with PHP

drgnfly1007
post 29 Jul, 2008 - 10:25 PM
Post #1


New D.I.C Head

*
Joined: 2 May, 2008
Posts: 1

I am modifying a guestbook that allows the user to enter info. into fields and then it sends it to a database. All the entries are also written to a text field in the same swf so they can be viewed.

I am trying to modify it so that it can be used as a submission form for a client. Everything works fine until I hit the submit button and the status field "gb_status" sends the message "undefined". Does anyone know what the coding error is? I have referenced toward the end of the code where it sends back the massage "undefined".

"write" is the name of the movie clip that the form is contained in.

This code is on the submit button itself not the action layer.

Thanks for the help.





on(click){
/*
Modify these reference paths to yours if you
have changed them. Also modify gb_status
reference path if required
*/
company = _parent._parent.write.company.text;
contact = _parent._parent.write.contact.text;
youremail = _parent._parent.write.youremail.text;
phone = _parent._parent.write.phone.text;
permit = _parent._parent.write.permit.text;
address = _parent._parent.write.address.text;
city = _parent._parent.write.city.text;
states = _parent._parent.write.states.text;
zip = _parent._parent.write.zip.text;


// Check variable data
if (company eq "") {
_parent._parent.write.gb_status.text = "Required: Company";

} else if (contact eq "") {
_parent._parent.write.gb_status.text = "Required: Contact Name";

} else if (youremail eq "") {
_parent._parent.write.gb_status.text = "Required: Email Address";

} else if (!youremail.length || youremail.indexOf("@") == -1 || youremail.indexOf(".") == -1) {
_parent._parent.write.gb_status.text = "Required: Valid Email Address";

} else if (phone eq "") {
_parent._parent.write.gb_status.text = "Required: Phone Number";

} else if (permit eq "") {
_parent._parent.write.gb_status.text = "Required: Resale Permit";

} else if (address eq "") {
_parent._parent.write.gb_status.text = "Required: Address";

} else if (city eq "") {
_parent._parent.write.gb_status.text = "Required: City";

} else if (states eq "") {
_parent._parent.write.gb_status.text = "Required: State";

} else if (zip eq "") {
_parent._parent.write.gb_status.text = "Required: Zip";


} else {
_parent._parent.write.gb_status.text = "Please wait...";
newEntry = new LoadVars()
newEntry.ref = this
newEntry.submit = "Yes"
newEntry.company = company
newEntry.contact = contact
newEntry.youremail = youremail
newEntry.phone = phone
newEntry.permit = permit
newEntry.address = address
newEntry.city = city
newEntry.states = states
newEntry.zip = zip

newEntry.sendAndLoad("GuestBook.php?action=write&r="+random(999), newEntry, "POST")
newEntry.onLoad = function(success){


if(success){


//The next line is where the status "undefined" is sent back to the Dynamic text box gb_status

_parent._parent.write.gb_status.text = this.gb_status;
_parent._parent.read.loadEntries("Default", 10);
// Clear fields
_parent._parent.write.company.text = "";
_parent._parent.write.contact.text = "";
_parent._parent.write.youremail.text = "";
_parent._parent.write.phone.text = "";
_parent._parent.write.permit.text = "";
_parent._parent.write.address.text = "";
_parent._parent.write.city.text = "";
_parent._parent.write.states.text = "";
_parent._parent.write.zip.text = "";





}
}
}
}
User is offlineProfile CardPM

Go to the top of the page


BetaWar
post 30 Jul, 2008 - 10:48 PM
Post #2


#include <soul.h>

Group Icon
Joined: 7 Sep, 2006
Posts: 1,669



Thanked 64 times

Dream Kudos: 1075
My Contributions


So I am assuming that you are echoing or returning or sending back the variable (sorry haven't actually used sendAndLoad as of yet) like so:

gb_status = Message and stuff?

If so I think the problem is that you need to have an & in front of variable names otherwise it is seens as undefined.

so try something like this:

&gb_status = Message and stuff

Here is where I got my info:
http://livedocs.adobe.com/flash/9.0/main/w...e=00001790.html

Also, in the future please place your code inside of these tags:

[code] Place Code Here [/code]

It just makes everything easier to read.

Hope that helps
User is online!Profile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 10/11/08 07:50PM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month