...

View Full Version : keys and value for specific _Post



turpentyne
08-01-2012, 10:09 PM
Probably a simple one, but I'm not sure.

EDIT: starting with array(2) { ["chosen"]=> string(8) "tactical" ["what_category"]=> string(10) "Buttstocks" }
EDIT: I want to add "What_category" as the key, and "tactical" as the value. I've got myself twisted around again. dang!

If I have a simple array_push that adds three or four times to:


$variable = $_POST['chosen'];
array_push($_SESSION['options_picked'],$variable);

I get eventually an array that lists something like
Array ( [0] => result1 [1] => Result2 [2] => Result3 [3] => 21 [4] => result4 [5] => result5 )


I want to keep the post key with it: so I have:
Array ( [categoryA] => result1 [categoryB] => Result2 [categoryC] => Result3 [categoryD] => 21 [CategoryE] => result4 [CategoryF] => result5 )

Arcticwarrio
08-01-2012, 11:21 PM
something like:


$result = array();

foreach ($_POST as $key => $post){
$result[$key] = $post;
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum