• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 10. Databases > Adding a Comments Input Form

Adding a Comments Input Form

So far we have displayed blog entries and comments from the database. You may now be wondering how a visitor can enter comments for blog entries. Obviously, they don’t have access to your database. They need a form of some sort to enter their comments. In this section we’ll create a form for adding comments, and I’ll show you exactly what needs to happen in PHP and MySQL for those comments to show up.

The process will involve three PHP pages. The first one you’re familiar with: It displays the blog entries and comments and is what we have worked on until now (Figure 10.6). The second page contains a form into which visitors can enter their comments (Figure 10.7). The final PHP page doesn’t display anything. It simply takes the form values and inserts them into the MySQL database and then returns the visitor to the first page, with the updated comments displayed (Figure 10.8).


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint