Jump to content

Comment Boxes


Spunky

Recommended Posts

So, I would like to learn how to implement comment boxes. I've finally been successful at having a submittable form from a website to a database which makes me happy so I know Im like a step or two away from having a successful comment box. I can code the actually comment box and whatever other fields would be made required to submit a comment, but what I really need to know is how to make the comment show up..and stay I guess. Cuz like, right now when I have someone submit a form and I know how to have that data appear on a temporary webpage just to thank them, but I know comments that are going to stick around and appear on a pernament webpage is going to work a little different.I am only on this forum seeking help on this topic because I tried to :) but all I was getting was free comments for MySpace or how to do the html part of it. Basically I am wondering if anyone can point me to a good tutorial website on this or just help me out a little if you can.Thanks.

Link to comment
Share on other sites

You need to store the data somewhere, so a database or files would make sense. A database would be more efficient. There are several tutorials on the site for using MySQL with PHP. There should be other tutorials online if you're using a different database or language.

Link to comment
Share on other sites

Yea, I have a database and have extensive use of using the database feature provided via my host. Would it be just having to have when the comment is submitted it gets stored in the database? Nothing else fancy? Like, right now my use of a database is I store information directly to it, then using php/mysql it displays the information. Is that all that would really need to be done?Only, Im expecting it to get a little more fancy if I decide to have it so I have to approve the comment in order for it to show. That would require if/then statements wouldnt it?

Link to comment
Share on other sites

the basic implementation is correct. post to the database and the retrieve it. to add an approval system, you probably want to make an admin page for yourself, and add an 'approved' field to the comments table. when someone posts a comment, it's default approved value in the database should be something like 0 or false. This admin page would show you a list of all comments in the comments table's who's approved "status" is false or 0. Then you could build the page so that the list of un-approved comments is a built into a form, and each comment gets a checkbox to approve the comment, and when you submit the form, all the forms who have boxes checked will get their approved status set to true or 1. Then, on your comments page, have the query only return comments WHERE approved = true || 1.to take it a step further, you could also add a delete option to the admin page to just delete comments you'll never approve, for decency, language, etc.

Link to comment
Share on other sites

Thank you. This is definetely something that is going to take some time to learn to do. ish. I was already thinking I would probably make some sort of admin page. But thats my next step: learning how to do logins. :)While we are on the subject. Can you generally explain how that is done? Obviously I would need a username and password in the table but how would I get the code to recognize a match?

Link to comment
Share on other sites

you need to query in your database where your user name and password combination match exactly. if you it returns any row (generaly it will return 1 row for unique user) you can assume the provided password and user name is correct so you can logged them in. if returns zero it means there is no result which match the criteria.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...