![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#21 |
|
Hobbyist Programmer
Join Date: Jan 2005
Posts: 110
Rep Power: 4
![]() |
hey this is what i have so far...
$dir = ".";
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
if (is_dir($file) == false) {
if (substr($file, -3) == mrc) {
print("<tr>\n");
print("<td><A HREF=\"Tester.php?filename=$file\">$file</A><BR></td>\n");
print("</tr>\n");
}
if (substr($file, -3) == ssa) {
print("<tr>\n");
print("<td><A HREF=\"Tester.php?filename=$file\">$file</A><BR></td>\n");
print("</tr>\n");
}
if (substr($file, -3) == ass) {
print("<tr>\n");
print("<td><A HREF=\"Tester.php?filename=$file\">$file</A><BR></td>\n");
print("</tr>\n");
}
}
}
closedir($dh);
}
}how would i include the get part your talking about? also how do i join strings togather for example in VB i use "h" & "h" to get hh what is it in php? and i found when i tryed using... if (substr($file, -3) == ssa) || (substr($file, -3) == mrc) {any ideas? thanks for your help ^_^ |
|
|
|
|
|
#22 |
|
Professional Programmer
|
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.. ![]() |
|
|
|
|
|
#23 |
|
Hobbyist Programmer
Join Date: Jan 2005
Posts: 110
Rep Power: 4
![]() |
Great!!
got it working hah nice thanks alot man ^_^ the only thing is the textbox always seems weird.. the lines dont always fit on. and i want it to be the like the background table. because i want to color the text but i need it to look good ![]() what could i do about this? i think i need to do it loop and read each line so i can add it to the table ![]() but..how? ![]() thanks for the great help ^_^ edit: i found how i can make the file loop through 1 line a time.. but when theres a space in the string the word wraps round >_< how can i fix this edit2: sorry im asking stupid questions im tired >_< but i got it working perfect now thanks for your help ^_^ Last edited by cloud-; Mar 12th, 2005 at 3:03 PM. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|