PDA

View Full Version : add a comment


vegasbp
02-26-2006, 04:06 AM
Hi, I am making a website and I would like to find out how to have a page and just have a simple input box, and have the text that is inputted posted to a page, sort of like a forum, what would be the simplest way to do this?

Pennimus
02-26-2006, 04:29 PM
See this post (http://www.codingforums.com/showthread.php?t=80594)

vegasbp
02-28-2006, 04:03 AM
thanks for replying, could you go into a little more detail on how to do it within flat text files?

ronaldb66
02-28-2006, 09:04 AM
Build a script to process the form used to enter a comment, which opens a text file and appends the new comment to the end of the existing ones (or creates a new file if none exists); build a second script to read the file and present its contents as an html page. "Script" as in "server side script", such as PHP, ASP, Perl, CGI... whichever you have available to you or you are comfortable with.

Pennimus
02-28-2006, 09:13 AM
The way I did it was using PHP, using it's assortment of file handling and writing functions, fopen (http://uk.php.net/manual/en/function.fopen.php), fwrite (http://uk.php.net/manual/en/function.fwrite.php) and fclose (http://uk.php.net/manual/en/function.fclose.php). Using those you can open your file (I believe it's created if needs be) and append the comment to the end or start along with any HTML formatting required, before closing it. You'd then simply include this file via php include into wherever you need the comments to appear.

You need a fairly solid grasp of form handling to deal with transferring the comment from the input box into a useable form, but the actual flat file bit is very simple.

vegasbp
03-01-2006, 01:15 AM
Ok, thanks ill look into it some more