Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End to .php or not to .php?

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #37319
    Anonymous
    Inactive

    Ok, doing my first site, so don’t be too cruel!

    I want to add a simple guestbook/comments section to my website pages 3 and 4 (out of 5 all in all) but…

    I’ve already done all the html and css parts on the forms – what’s left is form processing.
    The main question is:
    IS IT POSSIBLE TO MAKE MY FORM GET PROCESSED WITHOUT CHANGING DOCTYPE FROM .HTML TO .PHP ?

    I’ve already seen tons of scripts to process forms – I mean php to mysql etc. and even found and implemented a nice form, which actually required me to change two of my files 3.html and 4.html into 3.php and 4.php. But the question still remains – is this THE ONLY WAY?

    I’ve also read that one can change .htaccess file on the server side so it would read BUT, that is just a workaround, and also has issues (that will make ALL your .html files get processed by the server whether they have or don’t have any code in ’em.)

    Is there a way to do it as I think:
    1. a form on page.html sends data to .php (which is a separate file) via /form action=”processor script.php?/
    2. that “processor script.php” gets data and loads it to some database (let us say “database.db or .txt”)
    3. javascript (or what, say ajax, i don’t know yet) loads the data from “database.db or .txt” to page.html every time when it is loaded or refreshed.

    Is there a way that it will work? Don’t write the code yourself, just give a hint, or url example.

    Mind again I DON’T WANT TO ADD SCRIPT TO PAGE.HTML FOR IT WILL AUTOMATICALLY REQUIRE ME TO CHANGE PAGE.HTML INTO PAGE.PHP

    THANK YOU VERY MUCH!

    #99845
    Vermaas
    Participant

    HTML:



    // Your HTML code

    PHP:


    if($_SERVER === 'POST') {
    // Rest of your php code
    }
    ?>

    If you want to let your visitor stay on the html page, you’ll need some ajax for you to do the trick.

    #99848
    Anonymous
    Inactive

    Ok. thx. yet, not closing, will do the code and post it here. It would be nice if it gets assessed here)

    #99856
    mailmevenkat
    Member

    hmmm!it depends and no doctype is needed to be specified.what ever within the php tags will be processed in server and the outside php tags are processed client side.

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘Back End’ is closed to new topics and replies.