• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

Script which saves txt to a file (or template)?

( - P z Y - )

Active Member
..I know nothing helpful about any real scripting langauges (only VERY basics), so I ask. Anyone know of something which can save data submitted by a form to a flat file database or a template?
Thanks.
 
Well, I don't know what kind of form you're talking about or what you want to do with the data, so you may need something a bit more complex than this:
Code:
#!perl

open(FILE,">>/path/to/data/file.txt");
foreach $pair(split(/&/,read(STDIN,$buffer,$ENV{'CONTENT_LENGTH'}))){
	($name,$value)=split(/=/,$pair);
	$value=~tr/+/ /;
	$value=~s/%(..)/pack("c",hex($1))/ge;
	print FILE $name.": ".$value."\n\n";
}
print FILE "---\n\n";
close(FILE);
print "Location: [url]http://url/to/thankyou/page.html\n\n[/url]";
 
Back
Top