Not a Member Yet,
Click here to Register
How do you like the new design?

ID: 500
Viewed: 4525
Added: Jan 16, 2003
Version: php4.1+
Snippet uploaded by: snippet
Written By: snippet
Demo: Sorry, no demo

User Rated at: 0 Stars
Rate This:

Thank you for your vote. Please wait...

It appears you already voted for this snippet

It appears your vote value was empty

This little script has come up a few times so I thought I would write a simle one for somebody to use. it will load a textbox so you can type some text in it and hit save. It will then save what ever you wrote in the textbox to a file on the server. The file will be saved in the same directory as this script is residing. It uses SuperGlobals and must have register Globals set to off to be functional. Very easy to modify to get more out of it. Good Luck

browsers: All




if ($_POST['submit']){
// opens file for writing
$fileread = fopen("test.html", "w+")or die("Can't open file");
// check for special html characters and add slashes
$code = addslashes(htmlspecialchars($_POST['code']));
// right to file and insert all code
// close file
echo "File Saved";

} else {
//displays a textbox to enter some text to be saved.
echo "<div align="center"><form action="".$_SERVER['PHP_SELF']."" method="POST">";
echo "<b>Insert some words and hit save.</b><br>";
echo "<textarea type="text" name="code" rows="15" cols="75"></textarea><br>";
echo "<input type="submit" name="submit" value="Save"></form></div>";

// all done

No Comments to show

Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.

Replying to a Comment...

Adding your comment. Please wait...

Thanks for adding your comment!. After further review it will be added.

There was a problem adding your comment. Please try again.

Please complete all the fields in the form before sending.

© 2002 - 2018 All Rights Reserved. Conditions