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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux