its a really simple program.....im a newbie and Im still learning
With this little prgram i am trying to get it to let the user upload a file, and whatever they inputed in box one would be red, and whatever they inputed in box two would be blue
using patterns and eregi_replace
I want it to be able to fine the text they entered in the boxes and surround it with <font> tags......
/ $Printme = eregi_replace($pattern1, $replace1, $GetLine["0"]); /
right around there is where I am having trouble
can anyone help me??????
Pleeeeeeaaaaaase
Contents of uploadfile.php
<?php
if ($File) {
echo "File name : $File_name<p>";
echo "File size : $File_size<p>";
$Readfile = $File_name;
if (copy ($File, "$File_name")) {
echo "Your file was successfully uploaded!<p>";
} else {
echo "Your file could not be uploaded<p>";
}
unlink ($File);
}
$Thefile = $File_name;
$open = fopen ($Thefile, "r");
if ($open) {
echo "File uploaded contained the fallowing text:<br>";
$Data = file ($Thefile);
for ($n = 0; $n < count($Data); $n++) {
$GetLine = explode("\t", $Data[$n]);
$pattern1 = "$char1";
$pattern2 = "$char2";
$replace1 = "<font style=\"color:red\">$pattern1</font>";
$replace2 - "<font style=\"color:blue\">$pattern2</font>";
$Printme = implode ("<BR>", $GetLine);
/* $Printme = eregi_replace($pattern1, $replace1, $GetLine["0"]); */
echo " $Printme <br>";
}
fclose($open);
echo "<hr><p>\n";
} else {
echo "Error!!!";
}
?>
Contents of htmlformat.htm
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
</HEAD>
<BODY>
<form action='uploadfile.php' method="POST" enctype="multipart/form-data">
Exact name of charecter 1 : <input type=text name="char1" size=30><br>
Exact name of charecter 2 : <input type=text name="char2" size=30><br>
Select the file you want to be parsed: <br>
<input type=file name="File" size="60"><br>
<input type=submit name="submit" value="GO!"><br>
</form>
</BODY>
</HTML>