1234
07-14-2002, 07:51 AM
I try to show my file, but it is not working. My PHP is 4.2
My phpeditor says
Notice: Undefined index: fp in c:\itohideo\ito1.php on line 14
Notice: Undefined variable: filename in c:\itohideo\ito1.php on line 18
Warning: fopen("", "r") - No error in c:\itohideo\ito1.php on line 18
not open your file
Here is my code
<html>
<body>
<p>set up your file</p>
<form method="post" action="ito1.php">
<input type="text" size="80" name="filename"><br>
<br>
<input type="submit" name="submit" value="send">
<input type="reset" name="reset" value="reset">
</form>
<br>
<?php
$fp=$_POST["fp"];
if($_POST["submit"]!="")
{
$fp= fopen($filename,"r");
if(!$fp){
print("not open your file");
exit;
}
print("<TT>\n");
while($buf=fgets($fp,8192)){
$buf=htmlspecialchars($buf);
$buf=ereg_replace("\n","<br>\n",$buf);
$buf=ereg_replace(" ","$nbsp;",$buf);
print("$buf\n");
}
print("<TT>\n");
fclose($fp);
}
?>
</body>
</html>
Please fix my codes
Thank you
My phpeditor says
Notice: Undefined index: fp in c:\itohideo\ito1.php on line 14
Notice: Undefined variable: filename in c:\itohideo\ito1.php on line 18
Warning: fopen("", "r") - No error in c:\itohideo\ito1.php on line 18
not open your file
Here is my code
<html>
<body>
<p>set up your file</p>
<form method="post" action="ito1.php">
<input type="text" size="80" name="filename"><br>
<br>
<input type="submit" name="submit" value="send">
<input type="reset" name="reset" value="reset">
</form>
<br>
<?php
$fp=$_POST["fp"];
if($_POST["submit"]!="")
{
$fp= fopen($filename,"r");
if(!$fp){
print("not open your file");
exit;
}
print("<TT>\n");
while($buf=fgets($fp,8192)){
$buf=htmlspecialchars($buf);
$buf=ereg_replace("\n","<br>\n",$buf);
$buf=ereg_replace(" ","$nbsp;",$buf);
print("$buf\n");
}
print("<TT>\n");
fclose($fp);
}
?>
</body>
</html>
Please fix my codes
Thank you