Passing form data to a text file

  • Thread starter milefile
  • 10 comments
  • 580 views
10,832
I'm planing to put together my first working script (with a lot of help). It's a simple flat file blog, but hey, I'm a noob. I want entries to be made via a form, but I don't know how to pass the data to a text file.
 
A text file? Or a "document.php" file to display the text entered?
 
A text file, or so I though. Supposedly the php script opens the text file, reads, and displays it. From what I understand it is a simpler form of a database called a flat file. Maybe I'm misunderstanding it altogether.

If you just upload the text file it works, I've done that and seen it. The tutorial I used said you can use a form to add to the text file, which is obviously preferable to constantly uploading. Maybe the tutorial didn't mean that would work without changing the program.
 
Haha.

Mile, to make things simple, you could always just do:

PHP:
<?php
    $file = fopen("textfile.txt",r);
    $contents = fread($file, filesize("textfile.txt"));
    echo $contents;
?>

What this basically does is read the file into a variable and then simply echo it out onto the page. Not that hard, really...

Mile, if you need anything more, dont be afraid to ask.. ;)
 
This is a little of the subject, but i was wondering if any of you know or have had any experience with converting output from a java application to an HTML or a PHP document?

...so you could easily print it out. ... or save it, or email it...
-Spets
 
GilesGuthrie...dont worry, thanks for any input!

do any of you guys know any good programing forum?
something that includes, Java, Perl, C, C++, C#, Python ... etc?

Thanks in advance
-Spets
 
Originally posted by WanganDreams
GilesGuthrie...dont worry, thanks for any input!

do any of you guys know any good programing forum?
something that includes, Java, Perl, C, C++, C#, Python ... etc?

Thanks in advance
-Spets


http://www.devshed.com/

one of the best multi-technology developer sites on the net...and the forums are great...very knowledgable developers on there...

also check this multi-page article on php-java interfacing..

http://www.devshed.com/Server_Side/PHP/PHPwithJava/page2.html
 
Back