Hi Patrick,
Err... Basically what you ask us to do is do all your work ? ;-))
Concatenating a string can of course simply be accomplished by:
$c_var = $var1 . "|" . $var2 . "|" . $var3;
However, since you might not know just how many fields you have in your form, this might be more easy:
On the page that receives form input (post method!)
reset ($HTTP_POST_VARS);
$var = "";
while (list ($key, $val) = each ($HTTP_POST_VARS)) {
$var .= "|" . $val;
}
echo $var;
Var now should show all values of the submitted formfields with "|" in between. Of course you can adapt this code for leading "|" or not etc.
I guess you could use the same code as well to output to a .dat file, after of course testing this code with a simple "echo $var" to see it worked.
After you're sure, put this before the above example code:
$fp = fopen ("d:\inetpub\wwwroot\dir\blah.dat", "w");
Perhaps followed by:
$lock = flock ( $fp, LOCK_EX);
To lock the file exclusively.
Then within the "while" change code to:
fwrite ( $fp, $var . chr(13) . chr(10) );
(chr 13 and 10 provide "CR" and "LF", so your next line is written on a new line.)
Of course, after the "while" code, add:
fclose($fp);