DZone 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
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)?>">
<?
}
}





