How to Create a "Comments Form" That Posts Results to Same Page?

Discussion in 'PHP' started by babyphp, Jun 13, 2008.

  1. #1
    Hello everyone,

    I hope I am posting under the correct Forum. I am new to PHP code, but I am affluent in regular HTML code. I run an obscure movie review website and would like to be able to have a comment section after each movie review where someone can leave their comment and it gets posted under the review on the same page. I’ve been reading up on PHP for around 4 hours today and can’t seem to find any useful information. So could anyone assist me in doing this? I will give you complete credit for allowing me to have this type of format on the website.

    Thank you in advance.
     
    babyphp, Jun 13, 2008 IP
  2. Danltn

    Danltn Well-Known Member

    Messages:
    679
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    120
    #2
    $_SERVER['SCRIPT_NAME'] allows a form to point to itself.
    Create a DB holding the rows, when the form is filled in successfully, checked for bad input etc, then insert a new row.
    When you're showing the movie page, get the movieid, SELECT `comment`,`author` FROM `db` WHERE movieid = $id... then display them on the page.

    Fairly simple stuff, but I recommend you get more comfortable with PHP before trying anything you're not comfortable with.
     
    Danltn, Jun 13, 2008 IP