Forum Moderators: coopster
I'm having a heck of a time figuring this out, and would appreciate any info anyone might be able to shed on the subject..
I am a complete noob when it comes to scripting, first off..
I'm trying to come up with a way to use a form (php, or html) to save to a text file php include, that will be called from a "news" page on a company website..
ie: When someone with the company wants to add "blah blah Corp won the 2009 kissing butt award." They would go to a page, and there would be a form with the fields of "Heading" and "Body" - The output of that form when submitted would then be saved to a file called "newsinclude.txt" or whatever, and that would be called from the news page with a php include statement..
The include file would have to have some html within it to allow the heading info to be bold, etc.. I'm also trying to figure out how to make it so news items could be deleted from either another form, or some other method..
I've tried to look at overly basic cms setups, but none of them are simple enough to just drop a line into the news page to accomplish what I'm trying to create.. Whist my head spin, HELP! lol
Thanks for any advice, and especially for reading this junk :)
Mike
If you have the form submitting correctly you just need to start writing to a file. You can use the File System Functions [us3.php.net] to do that, more specifically the fwrite [php.net] function.
As far as being able to include them dynamically on the news page, that is something that may prove to be a little tricky. If you're up for the task, using some of those file system functions, you can find all the files in a particular directory and list them on the news index page. Then once you click on the link for that particular file it will open up a new page with that file's contents, and maybe a few other appropriate things. Just a thought, but that is how I would do it if I weren't going to use a database (which is what I would recommend here for something like this).
Try to throw something together the best you can and then we'll help you along further to see if we can't bang this out. :)