M626
Programmer
- Mar 13, 2002
- 299
Let me start off by saying i am new to PHP. I am basically learning as i go. I am trying to setup a form that will list all the contents of a server side file line by line and will append to that list as things are added when the page is reloaded. The file name will be today’s date so everyday, the page would load a new file for that date ex:3/15/2007. What i am trying to do is have some fields where users can enter some info and it's written to a server side flat filet that’s tab delimited. Of course i haven't gotten that working either but i think i can get that party but to have on the same page a form/list box where it displays line by line the contents of the file i am not sure how to do.
Here is the code i have been messing aroud with to write to a file. I can clear out my fileds.
<?php if($submit) {
$myFile = "\testFile.txt"; $fh = fopen($myFile, 'a+') or die("can't open file");
$stringData = "New Stuff 1\n"; fwrite($fh, $stringData); $stringData = "New Stuff 2\n"; fwrite($fh, $stringData); fclose($fh);
document.getElementById("request").value ="" document.getElementById("comment").value ="" document.getElementById("phonum").value ="" } ?>
Here is the code i have been messing aroud with to write to a file. I can clear out my fileds.
<?php if($submit) {
$myFile = "\testFile.txt"; $fh = fopen($myFile, 'a+') or die("can't open file");
$stringData = "New Stuff 1\n"; fwrite($fh, $stringData); $stringData = "New Stuff 2\n"; fwrite($fh, $stringData); fclose($fh);
document.getElementById("request").value ="" document.getElementById("comment").value ="" document.getElementById("phonum").value ="" } ?>