/    Sign up×
Community /Pin to ProfileBookmark

inserting an array into $_POST

I have the following array that came in from a flash form and then was unserialized and urldecoded.

$flashvars =

array(2) {
[“products_id”]=> int(28)
[“id”]=> array(12) {
[“txt_12”]=> string(0) “”
[“txt_11”]=> float(1999.9)
[“txt_10”]=> string(0) “”
[“txt_9”]=> string(17) “H1 – Floor Guides”
[“txt_8”]=> string(0) “”
[“txt_7”]=> string(9) “Lacquered”
[“txt_6”]=> float(2.21)
[“txt_5”]=> string(7) “Sliding”
[“txt_4”]=> int(2)
[“txt_3”]=> int(1700)
[“txt_2”]=> int(1300)
[“txt_1”]=> string(0) “” }
}

Now that it is processed I need to add it to the $_POST superglobal.

Thanks in advance for any advice

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@NogDogMar 20.2008 — Well, the simplest thing would be:
[code=php]
$_POST['flashvars'] = $flashvars;
// to use a value:
echo $_POST['flashvars']['products_id'];
[/code]
Copy linkTweet thisAlerts:
@celshaderauthorMar 20.2008 — It's for a ready made shopping cart (Oscomerce) that is all already set up for

$_POST['products_id'];

and

$_
POST['id'];

so I need to add

$products_id

and the array $id

to the super global $_POST

from $flashvars
Copy linkTweet thisAlerts:
@NogDogMar 20.2008 — Then use a foreach loop:
[code=php]
foreach($flashvars as $key => $value)
{
$_POST[$key] = $value;
}
[/code]
×

Success!

Help @celshader spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.1,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...