CreatureOfHabit Posted August 31, 2006 Share Posted August 31, 2006 I am looking for a way to write data from a Form to a file that i could later access and fill in the form again.I have an online application form that will email my boss the data when submitted:foreach ($_POST as $Field=>$Value)$MsgBody .= "$Field: $Value\n\n";The problem is that the boss doesn't like the way that it is formatted and would prefer to see the information in a form (identical to the form the user fills out). Because the form has approx 30 fields, i thought it might be easier to write the data to file instead of storing it in a DB.Any help would be appreciated.Creature Quote Link to comment Share on other sites More sharing options...
hitman6003 Posted August 31, 2006 Share Posted August 31, 2006 create a multidimensional array...each element contains a subarray that contains all of your items...then just serialize it and save it to the file.[code]<?php$formresults = unserialize(file_get_contents("formresults.dat"));$formresults[$clientname_or_some_other_identifier] = $_POST;$open = fopen("formresults.dat", 'w');fwrite($open, serialize($formresults));fclose($open);?>[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.