It seems that you forgot the quotes inside your html statements. Like:
print "<form name=\"myform\" action= \"fileio.php\">";
etc...
Alain
Joey Garcia wrote:
>
> I an using the fwrite command to show how it works but it is writing extra
> data. For example, I have a Form text box that prompts for a new string of
> data then on submit it writes this to the text file and for just a test I
> wrote "this is a test" and I got the text below. I don't understand why??
>
> this is a testy>
> </html>
> / / DTD HTML
>
> I put a space between the two slashes otherwise Outlook puts a "file:" in
> front of it like this //
>
> Here is a snippet of my code for performing the write, there is enough here
> show you my approach.
>
> print "<form name=myform action=fileio.php>";
>
> $filename="c:\\Program Files\\Apache Group\\Apache\\htdocs\\testfile.txt";
> $fp=fopen($filename, "r+");
>
> if (!empty($newText)){
> fwrite($fp, $newText);
> fclose($fp);
> $fp=fopen($filename, "r+");
> $contents=fread($fp, filesize($filename));
> }else {
> $contents=fread($fp, filesize($filename));
> }
> fclose($fp);
>
> print "The content of the file is: <p><b>".nl2br($contents)."</b>";
> print "<br><p>Enter some text to write to the file.<br>";
> print "<input type=text name=newText size=30><br>";
> print "<input type=submit value='write text'>";
>
> Note: I know I probably shouldn't write to a file and then reopen it, but I
> am trying to demonstrate that I am actually reading and writing so I didn't
> want to cheat and say I was actually reading it when I wasn't.
>
> The resulting text always has the "testy>
> </html>
> // DTD HTML " text appended after it. (???????)
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]