note 34147 deleted from language.types.array by tomsommer
| From: | tomsommer@php.net | Date: | Sat, 03 Jul 2004 13:21:56 +0000 |
| Subject: | note 34147 deleted from language.types.array by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-72421@lists.php.net to get a copy of this message | ||
Note Submitter: jpipes1@columbus.rr.com
----
/*
This utility function will write out all form fields,
including form arrays, as hidden textboxes
*/
function WriteHiddenFormValues() {
global $HTTP_POST_VARS;
$sTemp = '';
foreach ($HTTP_POST_VARS as $FormFieldName=>$FormFieldValue) {
if (gettype($FormFieldValue) == 'array') {
$iCount = count($HTTP_POST_VARS[$FormFieldName]);
for ($i=0;$i<$iCount;$i++) {
$FormFieldValue = $HTTP_POST_VARS[$FormFieldName][$i];
$sTemp .= "<input type=\"hidden\" name=\"" . $FormFieldName .
"[$i]\" value=\"$FormFieldValue\"/>";
}
}
else {
$sTemp .= "<input type=\"hidden\" name=\"$FormFieldName\"
value=\"$FormFieldValue\"/>";
}
}
echo $sTemp;
}
/*
I use this function whenever I do a "confirmation" type page, where I want to display what
the user has input or modified on the posting form and keep the data in the same fields, so all I
have to do is submit the confirmed form data again to the "final" page.
*/