Re: Can PHP be used to write permanent file changes?




sethjohnson777@xxxxxxxxxxx wrote:
Hey everyone, sorry as usual if this is the wrong place to post this
but...

I have an idea and I want to build a web based prototype and to start
with I just need to know how to make pages where the user can type a
response eg "Hello, I believe in Peace, Love and Understanding", and
then click submit and then the web page is altered to include that text
somewhere on it. If new users navigated to the page then they would see
everyone's previous submissions.

I know it's not rocket science and my html skills are basic but fine
but reading around I'm not sure if I should do this with javascript,
perl, php, cgi or something else so I was wondering what you would
advise?

From what I've read, PHP will do that but is not be able to actually
write the new html file on the server? Just a point in the right
direction would be much appreciated!

Thanks,
~Seth Johnson.

Any system that does what you describe requires (at a minimum) the
following:

1) Something to process user submissions and store them
2) A place for storing submissions indefinitely
3) Something to retrieve the stored data and display it to the user

A pure client-side solution fails all three of these requirements, so
forget about Javascript. Perl, PHP, and other cgi's can all handle #1
and #3. #2 requires a file in the server's filesystem (as you've
described), a database, or some other storage mechanism.

For whatever it is you want to do a database will probably give you
more flexibility than simply writing the text to flat files.

Having said that, PHP can -- if configured correctly and given
appropriate filesystem permissions -- write anything you want anywhere
on the server. In other words, PHP has no problem writing an HTML file
to the server on which it's executing.

.



Relevant Pages

  • Re: Change included code
    ... Index.php is basically an html file uses a linked css file and when its included in the new file its referencing a css file in the wrong spot. ... It would actually be a bit more trouble since any time I want to upload to the server to test I will have to change the link. ... Would be easier just to have php just add "../" to one spot instead manually doing it every time I upload to the server. ...
    (comp.lang.php)
  • Re: php requires ".php" not ".html" ?
    ... Is there anyone else reading here who thinks Jerry is correct? ... concerned with security than those who write .php files, ... But when you make the server parse an .html file for .php it places a greater work load on the server more so than if the server know if the file was a .php When you make these changes the server no has to parse each and every file for .php code. ...
    (comp.lang.php)
  • Re: php requires ".php" not ".html" ?
    ... Is there anyone else reading here who thinks Jerry is correct? ... concerned with security than those who write .php files, ... But when you make the server parse an .html file for .php it places a greater work load on the server more so than if the server know if the file was a .php When you make these changes the server no has to parse each and every file for .php code. ...
    (comp.lang.php)
  • Re: php requires ".php" not ".html" ?
    ... Is there anyone else reading here who thinks Jerry is correct? ... those who write .php files, as if a bloody file extension matters. ... server parse an .html file for .php it places a greater work load on ... the server more so than if the server know if the file was a .php When you ...
    (comp.lang.php)
  • Re: Change included code
    ... its included in the new file its referencing a css file in the ... upload to the server to test I will have to change the link. ... be easier just to have php just add "../" to one spot instead ... in the main html file I have ...
    (comp.lang.php)