I'm not quite sure what you want to do, but this is how I interpreted your problem:
I wouldn't use text files to solve this problem! I'm assuming that you're using MySQL, and therefor this is the script:
<html>
<head>
<title>Add Text To A Table Using A Form</title>
</head>
<body>
<?php
if(isset($actionflag))
{
// MySQL variables
$host = "localhost"; // host
$user = "root"; // user
$pass = ""; // password
$db = "database"; // name of your database
// MySQL Connection
$link = mysql_connect($host,$user,$pass)
if(!$link)
die(mysql_error());
// Database selection
$select = mysql_select_db($db);
if(!$select)
die(mysql_error());
// Database Query
$query = "INSERT INTO table(val1,val2,val3)
VALUES('$val1','$val2','$val3')";
$result = mysql_query($query);
if(!$result)
die(mysql_error());
}
else
{ // Escape from php mode
?>
This code will print the form used to add the text to the database:
<form action="<?php print $PHP_SELF; ?>" method="post">
<input type="hidden" name="actionflag" value="1">
value 1: <input type="text" name="val1"><br>
value 2: <input type="text" name="val2"><br>
value 3: <textarea cols="20" rows="5" name="val3"></textarea><br>
<br>
<input type="submit" value="Add To Table">
</form>
<?php
} // This ends the 'else' statement
?>
You must change val1, val2, val3 to your columns in your table.
Hope this was what you wanted to have...