I have a website of poetry, what I would like is for users to be able to leave comments on the poems they've read, I already have a system for voting on a poem but I thought it might be nice to be able to leave a small comment.
Would this be possible? and if the answer is yes how would I start?


Recommended Answers

All 3 Replies

Very simple. List all the comments in the table(if any), have a textarea and a button. When the button is clicked, add the contents of textarea to the comments column.

//select db

if(isset(submit button)){
  //insert into table (comments) values (textarea_contents)
//query to display the poem.
//print the poem.
$q="select comments from table where poem_id=$id";
//print the comments
<textarea name=comments></textarea>
<submit button>

Thanks for the reply Navman,
I half understand what's happening in the code you've shown me, but I take it I need a database for this to work?

Yep. Or you can write the comments to a file and then display the contents of that file.

commented: Always willing to help. +1
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.