our approach
|
contact us
PHP Basics In Pictures
Basics
Variables
Numbers
User functions
Logic & Loops
Files
Append to files
Create a new script with this code:
<html>
<head>
<title>Append to files</title>
</head>
<body>
<h2>Add to Today's Thought</h2>
<p><b>Today's Thought is ...</b></p>
<?php
$myfile = fopen ('textthought.txt', 'r') or die ("Can not open file");
while (!feof($myfile)){
$line = fgets($myfile,4096);
print "$line <br>";
}
fclose($myfile);
?> <form action="textappender.php" method="post">
<input type="hidden" name="filename" value="textthought.txt">
<b>Write what you want to add here ... </b><br>
<textarea name="comments" rows="3" cols="50" wrap></textarea>
<input type="submit" value="Update Thought" name="submit">
</form>
</body>
</html>
Save the script as
textappenderform.php
in the
PHPSCRIPTS
folder.
Then upload it to the home directory in your Web site.
<< BACK
NEXT >>