Current location: Hot Scripts Forums » Programming Languages » PHP » Submit text in a form to txt file


Submit text in a form to txt file

Reply
  #1 (permalink)  
Old 02-15-06, 06:31 PM
Dooms_day Dooms_day is offline
New Member
 
Join Date: Feb 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Submit text in a form to txt file

ive looked everywhere on how to submit what people put in a form to a text file stored localy, can anyone put an example or tell me the command?

thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 02-15-06, 08:05 PM
wirehopper's Avatar
wirehopper wirehopper is offline
-
 
Join Date: Feb 2006
Posts: 2,516
Thanks: 20
Thanked 109 Times in 106 Posts
Here's a PHP approach - you can probably translate it to another language, too.

<?php

// This just names the file
$target_filename = "textfile";

// Create an empty buffer
$message = "";

// This gets all the form keys (names) and values
foreach ($_POST as $key => $value)
$message .= "$key: $value\n";

// Put the date in
$message .= date("F j, Y, g:i a");

// Open the file and write it out
$fp = @fopen($target_filename,"wt");
if ($fp != NULL)
{
fputs($fp,$message);
fclose($fp);
}

?>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 02-16-06, 06:54 AM
Dooms_day Dooms_day is offline
New Member
 
Join Date: Feb 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks so much i just remembered a while ago i learned about fopen, so thanks for refreshing my memory!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Form to Text File Justin171985 PHP 14 02-09-11 12:55 PM
Form Results to an HTML or Text File bxcheats PHP 3 09-25-04 11:46 AM
Upload file to table so ONLY files tied to primary key are displayed in record? grafixDummy PHP 4 12-20-03 05:28 PM
picking random entries with a filter... Double selection problem dsumpter PHP 7 11-16-03 08:19 PM
Need to submit form to database and text file - Any ideas how? dpreiss ASP 1 08-21-03 07:02 PM


All times are GMT -5. The time now is 06:42 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.