RE: [PHP] array_push but with key, value pairs

From: Date: Tue, 17 Apr 2001 05:29:02 +0000
Subject: RE: [PHP] array_push but with key, value pairs
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-48894@lists.php.net to get a copy of this message
maybe tring this ... $input = array(); reset ($HTTP_POST_VARS); while ( list($key, $val) = each($HTTP_POST_VARS) ) { if ( $key != "Submit" ) { array_push($input, $val); } } Peter -----Original Message----- From: Joseph Blythe [mailto:joe.blythe@binarylogic.com.au] Sent: Tuesday, April 17, 2001 3:13 PM To: php-general@lists.php.net Subject: [PHP] array_push but with key, value pairs Hey all, I was just trying to figure out something that should be quite simple but seems to be eluding me, consider the following: $input = array(); while ( list($key, $val) = each($HTTP_POST_VARS) ) { if ( $key != "Submit" ) { array_push($input, $val); } } Ok fine, I now have an associative array with a numeric index, but hangon I wanted to push the key => value into the array. How would I do this, I have tried a couple of things but am having some really crazy results ;-) What I am really trying to do is create a new array from the HTTP_POST_VARS while excluding certain fields, like Submit or the X and Y values from a image button. Any ideas/suggestions are very welcomed, Regards Joseph, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#48894) next »