note 34147 added to language.types.array

From: Date: Thu, 17 Jul 2003 03:51:31 +0000
Subject: note 34147 added to language.types.array
Groups: php.notes 
Request: Send a blank email to php-notes+get-52247@lists.php.net to get a copy of this message
/* 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. */ ---- Manual Page -- http://www.php.net/manual/en/language.types.array.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+34147 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+34147&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+34147&report=yes

« previous php.notes (#52247) next »