Honesty Rocks! truth rules.

Updating Php File Through A Web Form

HOME      >>       Programming

demonlord

Hello, i'm not sure if this can be done with php or not but what i need is a way to make an php file that have an html form on it and it will take the info you put in to that form and write it to an existing php file, for example: if i have the file news.php and the file news_update.php. if you went to news_update.php you would get an form with a text area for you to write a new addition for the news.php file and when you hit submit it will add what you typed in the form to the file news.php. If this is going to be a big code or a hard one to make but some one thinks they can make it let me know either via post or pm and i can give some credits for the code. if some one knows of such a pre-exsting code that is free please post it. Thanks


jlhaslip

Do you want all of the News stories placed into the same file? or one file per story?Looks like you might be able to use a Content management system that lets the members update the site? like a wiki?


darran

I agree, I believe what you are trying to emulate are examples of blog posts except that the data will not be stored in a sql table but rather a file. Am I right? There are several alternatives out there like WordPress, CuteNews ... etc


galexcd

You could use fwrite for this, but I would not suggest writing directly to the php file. Instead write to a text file that the php file includes. That way if anybody finds your updater they won't be able to seriously damage your website.


demonlord

You could use fwrite for this, but I would not suggest writing directly to the php file. Instead write to a text file that the php file includes. That way if anybody finds your updater they won't be able to seriously damage your website.

how would i do that, as for the content managment softwares i'm trying to avoid thoses because for some reason they confusise the pastor of my church and it's going to be him updating the news section for the page while i take care of everything else.

jlhaslip

I would say to check-out Cutenews (be sure to use the recent patch) and My Little CMS.Both of them use flat-files and have a page for inserting the News Item (article). Quite easy to use.