PHP Help...

edited June 2003 in Science & Tech
Okay....I am trying to write a content displayer thing....it would have a text filename passsed to it (minus the .txt) and then it would output the text file.
Example: www.....com/blah.php?p=suck would output suck.txt

Only problem is htat it doesnt. It has to be something i am doing horribly stupid, because it works if I manually declare $p to a text file name...

<head><title>php shizzy</title></head>
$p=$p . ".txt";
if (!file_exists($p)) {
echo "Couldn't find file...";
else {
$newfile = fopen($p,"r");
$content = fread($newfile, filesize($p));
$content = stripslashes($content);
$content = htmlentities($content);
$content = nl2br($content);
echo $content;
Any ideas? Sorry for being so ubernewb.


  • EnverexEnverex Worcester, UK Icrontian
    edited June 2003
    I believe

    $p=$p . ".txt";

    needs to be:

    $p="$_GET . '.txt'";

    Or something close to that.

  • edited June 2003
    minus the <<">>'s around the $_GET...txt' and it worked beautifully.
    thank you so much dude.
Sign In or Register to comment.