Help me make a php editing tool for webmasters
Posted: Sat Feb 27, 2010 1:39 pm
hey guys last night i had an idea to make a simple editing tool.
now i know similar tools like this are out there, but i thought it would be cool to make one.
so basicaly i want it to do the following.
1. load the file from off the server
2. include the file in a text field (so that i can edit it)
3. then at the bottum of this text field have a save button which will write the files to the new page.
i though this would be just a slight chalenge but i have run into a problem when it comes time to laod the document.
we will use a txt for the example.
the code
as u can see (if u run this code) that it will load the textfile but not in side the text area (which i intended for it to do)
you can also see that i haven't include the write code yet. I figure it is best to take one step at a time.
can anyone help me with this?
also if you try to load a .html document it will load the page. all i want it to loa is the code.
thanks for any help!
-James lat
now i know similar tools like this are out there, but i thought it would be cool to make one.
so basicaly i want it to do the following.
1. load the file from off the server
2. include the file in a text field (so that i can edit it)
3. then at the bottum of this text field have a save button which will write the files to the new page.
i though this would be just a slight chalenge but i have run into a problem when it comes time to laod the document.
we will use a txt for the example.
the code
Code: Select all
<html>
<head></head>
<body>
<h2>Get er done</h2>
<?php
///by James Lat
if (!isset($_POST['submit'])){
?>
<form action = "<?php echo $SERVER['PHP_SELF']; ?>" method="post">
Load you file: <input name="myfile" size="10">
<input type="submit" name="submit" value="Load">
</form>
<form method="post">
<textarea cols="50" rows="4" name="myfile">
<?php
}
else{
$myfile=$_POST['myfile'];
include("$myfile");
}
?>
</textarea>
</form>
</body>
</html>
you can also see that i haven't include the write code yet. I figure it is best to take one step at a time.
can anyone help me with this?
also if you try to load a .html document it will load the page. all i want it to loa is the code.
thanks for any help!
-James lat