Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0

Reply
 
Thread Tools Rate Thread Display Modes
Old 02-26-2008, 01:14 PM   #11
daveystew
Dave Stewart
 
daveystew's Avatar
 
Join Date: Aug 2005
Location: London
Posts: 749
Default

Quote:
Originally Posted by xxneon View Post
just an FYI.. you can not send an array object as it is to a php script .. you need to have all your values in one long string ..
Ah, Ok - my fault - I'm coming back to Flash after about a year's break in PHP!

Quote:
Originally Posted by xxneon View Post
and then in your php you will have a variable passed called record1 .. that you will have to split the string .. so you can get each part of your record that you want to save..
Not so.

If you pass the string like this:

Code:
"data[0][first_name]=Dave&data[0][last_name]=Stewart&data[1][first_name]=Joe&data[1][last_name]=Bloggs"
PHP should read the string as a native multidimensional array:

Code:
Array
(
    [data] => Array
        (
            [0] => Array
                (
                    [first_name] => Dave
                    [last_name] => Stewart
                )

            [1] => Array
                (
                    [first_name] => Joe
                    [last_name] => Bloggs
                )

        )

)
At least it does with HTML - you'll have to check with the Flash thing, but I don't see how the PHP would receive it any differently anyway. You may have to use GET not POST though (or you may not. I haven't tested it)

Last edited by daveystew; 02-26-2008 at 01:19 PM.
daveystew is offline   Reply With Quote
Old 02-26-2008, 01:18 PM   #12
daveystew
Dave Stewart
 
daveystew's Avatar
 
Join Date: Aug 2005
Location: London
Posts: 749
Default

(Duplicate post)
daveystew is offline   Reply With Quote
Old 02-26-2008, 01:33 PM   #13
xxneon
MCL -- FTW
 
xxneon's Avatar
 
Join Date: Dec 2006
Location: Amish Country, PA
Posts: 7,583
Send a message via ICQ to xxneon Send a message via AIM to xxneon Send a message via MSN to xxneon Send a message via Skype™ to xxneon
Default

well the problem is you can't have a loadvars send a string like yours using variable value pairs .. unless you use GET .. and i think that would get ugly as a GET query string ..
__________________
Always optimizing...
xxneon is online now   Reply With Quote
Old 02-26-2008, 02:08 PM   #14
daveystew
Dave Stewart
 
daveystew's Avatar
 
Join Date: Aug 2005
Location: London
Posts: 749
Default

Quote:
Originally Posted by xxneon View Post
i think that would get ugly as a GET query string ..
Does that matter? No one's going to see it.

Just iterate through to get the string:

ActionScript Code:
var userArray:Array = new Array; // you need an array in this case userArray[0] ={first_name:"john", family_name:"smith",age:25}; // you need correct object syntax using {} curly braces userArray[1] ={first_name:"jane", family_name:"brown",age:27}; function arrayToGET(arr:Array, name:String){     var arrArray    :Array  = new Array()     var arrObject   :Array     var strObject   :String     for(var i = 0; i < arr.length; i++){         arrObject = new Array()         for(var p in arr[i]){             arrObject.push(name+ '[' +i+ '][' +p+ ']=' +arr[i][p])             }         strObject   = arrObject.join('&')         arrArray.push(strObject)         }     return arrArray.join('&')     }     trace(arrayToGET(userArray, 'userArray'))

ActionScript Code:
userArray[0][first_name]=john&userArray[0][family_name]=smith&userArray[0][age]=25&userArray[1][first_name]=jane&userArray[1][family_name]=brown&userArray[1][age]=27
daveystew is offline   Reply With Quote
Old 02-26-2008, 02:09 PM   #15
xxneon
MCL -- FTW
 
xxneon's Avatar
 
Join Date: Dec 2006
Location: Amish Country, PA
Posts: 7,583
Send a message via ICQ to xxneon Send a message via AIM to xxneon Send a message via MSN to xxneon Send a message via Skype™ to xxneon
Default

i guess the only issue is depending on the amount of info sent via GET.. it does have a limit i think.. correct?
__________________
Always optimizing...
xxneon is online now   Reply With Quote
Old 02-26-2008, 02:15 PM   #16
daveystew
Dave Stewart
 
daveystew's Avatar
 
Join Date: Aug 2005
Location: London
Posts: 749
Default

Yeah, I think there is. A google later and:

Quote:
If you are using the GET method, you are limited to a maximum of 2,048 characters, minus the number of characters in the actual path.

However, the POST method is not limited by the size of the URL for submitting name/value pairs. These pairs are transferred in the header and not in the URL.
daveystew is offline   Reply With Quote
Reply


Thread Tools
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
send variable to php dreimann Server-Side Scripting 3 02-22-2007 04:48 AM
can't get PHP to send mySQL info back to Flash Darkware Server-Side Scripting 12 09-11-2005 04:27 AM
Database simulated with arrays on a cd-rom lecasn5 Components 61 09-07-2004 11:40 AM
show me the php script!... gk26 ActionScript 1.0 (and below) 1 10-27-2003 10:59 AM
Send to PHP then include that PHP holtzy Server-Side Scripting 3 03-06-2003 03:06 PM


All times are GMT. The time now is 07:54 PM.


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2010 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.