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

Arthur has posted 13 posts at DZone. View Full User Profile

PHP: Pass On Values For A Multi-Page Form

07.19.2007
| 8099 views |
  • submit to reddit
        While the best way to do this involves saving the data into a database and passing an encrypted reference to the next page, this method will suffice for non-critical uses.

foreach ($_POST as $field=>$value) {
	echo "<input type=\"hidden\" name=\"" . $field . "\" value=\"" . $value . "\" />";
}
    

Comments

Kenneth Mccall replied on Fri, 2007/08/10 - 12:56pm

I've had to use that code before. It's quite nice. You can also load all the post's to the $_SESSION.