Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

pass variable as hidden (See related posts)

pass variable as hidden field
recursively handles array
eg usage:
foreach ($_REQUEST as $key => $val)
pass_hidden($key, $val);
 
function pass_hidden($key, $val) {
  if (is_array($val)) {
    foreach ($val as $k => $v) 
      pass_hidden("{$key}[{$k}]", $v);
  } else {
    ?><input type="hidden" name="<?=$key?>" value="<?=htmlspecialchars($val)?>">
    <?
  }
}

You need to create an account or log in to post comments to this site.


Click here to browse all 4858 code snippets

Related Posts