View Single Post
Old Mar 12th, 2005, 8:16 AM   #22
Dizzutch
Professional Programmer
 
Dizzutch's Avatar
 
Join Date: Dec 2004
Location: Worcester, MA
Posts: 441
Rep Power: 4 Dizzutch is on a distinguished road
Send a message via ICQ to Dizzutch Send a message via AIM to Dizzutch Send a message via MSN to Dizzutch Send a message via Yahoo to Dizzutch
is that file Tester.php? the GET request is the action of sticking a variable name behind the URL. so Testing.php?filename=$file, here ?filename=$file is the GET request, you can define multiple by by apostrophes ex. ?filename=$file&id=$id now in PHP you can grab these variables using the $_GET[] array, you can get $file by calling $_GET['filename']; and $id by $_GET['id']; so in your case you're gonna want to do something like this.
[php]
<?
$filename = $_GET['filename'];
if($filehandle = fopen($filename, "r")) or die("could not open file\n");
$contents = fread($handle, filesize($filename));
fclose($filehandle);
echo "<form action=\"saveform.php\", method="post">\n";
echo "<textarea cols=6 rows=30 name=\"text\">\n";
echo $contents;
echo "</textarea>\n";
echo "<submit value=\"save\" type=\"submit\">\n;
echo "</form>\n";
[/php]
then in saveform.php you can process the data sent through the form. This time I'm using the POST request, which is similar to GET except that the text doesn't get shown in the URL, which makes it more secure. I'm not gonna write all of that out, but use http://php.net/fwrite to find some examples of how to do that, but the text should be stored in $_POST['text']; since it's a POST request.
good luck
lemme know if you're stuck.
Dizz
ps. the code i wrote has not been tested, so i'm not responsible for bugs..
__________________
naked pictures of you | PFO F@H stats
Dizzutch is offline   Reply With Quote