Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Mar 12th, 2005, 6:04 AM   #21
cloud-
Hobbyist Programmer
 
Join Date: Jan 2005
Posts: 110
Rep Power: 4 cloud- is on a distinguished road
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) {
it didn't work
any ideas?

thanks for your help
^_^
cloud- is offline   Reply With Quote
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
Old Mar 12th, 2005, 12:16 PM   #23
cloud-
Hobbyist Programmer
 
Join Date: Jan 2005
Posts: 110
Rep Power: 4 cloud- is on a distinguished road
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.
cloud- is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 5:51 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC