You are invited to Log in or Register a free Frihost Account!

PHP Text Edit

Well, i'm in a problem here, and i'm hoping someone has the answer to the solution.

I need to make a simple editor in php, that can load and save the text files (only .txt, no mysql).
I wanted to be able to choose the files i wanted to edit from a list, and then be able to make the changes, and simply save the file. I might not sound so difficult, but i'm a nutbrain regarding php.
I also drew a painting showing what i wanted (in case ^ was ununderstandable):

Thanks in advance! Smile
Well its not that difficult to rig this up in html/php. Though sorry to say I not going to do it for you as I very busy myself (unless you pay me Cool ) but I am sure you could find a script that does something like described. Remember google is your friend and here is a good website I would recommend for free scripts
Thanks for you answer, i've already looket at hotscripts, but i'm not gonna pay 25-100$ for at smart editor than can make colors n' shit, when all i need is a script that kan read and write to a .txt file, chosen from a list.

The hardest part (to me) is to make i communicate with the list/menu. I kinda already know how to make the text edit and save.

This is what i've managed so far:
<form id="txtEditDir" name="txtEditDir" method="post" action="<?php "$identifyTxt" ?>">
<select name="Directory Listing" class="Listings" id="Directory_Listing">
<option id="Field 1" value="frontpage">Field 1</option>
<option id="Field 2" value="chatfield">Field 2</option>
Choose the site you want to update</label>
<input name="Choose" type="submit" class="Jbuttons" id="Choose" value="Edit" />

And php:
$identifyTxt = txtEdit();
function txtEdit() {
$options = array("../Rakenfiles/chatfield.txt","../Rakenfiles/newsfield.txt");

I have no idea whether it's on the right path, or totally incorrect.
from what I can make out of your code your a good bit off. I would recommend you go to and read through the php tutorials there. They are very simple and will give you all you need to know how code the editor.
Also there are many free open source php script site around, you just need to search around for them. but I would recommend learning php yourself, much more fun and useful.
Well, that might be worth a try, thanks!
Well as another source for file editing, without the use of MySQL, you can take a look at Tizag's Files tutorial under PHP:

On the left menu, just look for the links under "PHP Files" to continue the tutorial, or hit "Next" on the page.

But that's without the use of an editor. What you could do is, within the File writing, is replace:

$stringData = "Bobby Bopper\n";

With the POST variable in, say a textbox called "edit". So the form would look like:


<form action="blah" method="POST">
<textarea name="edit"></textarea>
<input type="submit" value="Edit" />

And the $stringData variable would be seen as:

$stringData = $_POST['edit'];

But from there, you'll have to read the tutorials to get an understanding of what you want everything to do and such. This is just for editing the file, but to view the file itself by using a form, you just use the same concept from above but using the File Open codes.

Hope that wasn't too confusing Sad

I also wouldn't recommend using the exact codes above, their just for an example. More things would need to be done to show what exactly resides within the files that would appear in the textbox for you to edit it.
Related topics
Anyone good with PHP-NUKE?
PHP include code problem
Need a simple Contact form
Anyone know how to make an email form?
Can I have some help with scripts for
Notepad2 Help.
Error I can't seem to fix.
Deleting certain lines from text file
is there a 'stupid setting' in php or something??
If You Are Replacing Notepad
RJ text edit
Php generator. [help] [solved]
Getting Fatal Error in php mysqli
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

© 2005-2011 Frihost, forums powered by phpBB.