[Solved] Any ideas why this simple code isnt working?


Your problem here is the use of each(). It remembers the index it has reached in the array so in your second loop there is nothing left to loop out so it evaluates to false. If you use reset() this should resolve the issue.

while(list($get_key, $get_value) = each($HTTP_GET_VARS)) {
  if (!${$get_key}) {
     ${$get_key}=$get_value; 
  }
}

reset($HTTP_GET_VARS);//will put the pointer back to the first element

while(list($keyone, $valueone) = each($HTTP_GET_VARS))    
{
  echo $keyone;
}

Alternatively you can just use the foreach(){} syntax which will always start from the first element in the array.

solved Any ideas why this simple code isnt working?