RE: [PHP] $_POST returns Array when getting data from multiple dropdown

From: Date: Thu, 01 Dec 2005 09:03:29 +0000
Subject: RE: [PHP] $_POST returns Array when getting data from multiple dropdown
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-226690@lists.php.net to get a copy of this message
Erfan Shirazi wrote: > I want to get all data passed on to a certain page, I use this to make > it happen: > > foreach($_POST as $key => $tempvalue) > { > $cVariable .= $key."=".$tempvalue."&"; > } Try: <? function getValues($arrayWithValues, $pre='') { $tmpVal = ''; foreach($arrayWithValues as $key => $tempvalue) { if (is_array($arrayWithValues[$key])) { $tmpVal .= getValues($arrayWithValues[$key], $key); } else { $tmpVal .= $pre.$key."=".$tempvalue."&"; } } return $tmpVal; } $cVariable = getValues($_POST); print $cVariable; ?> Hope it helps Albert -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.362 / Virus Database: 267.13.10/189 - Release Date: 2005/11/30

« previous php.general (#226690) next »