guitarscn Posted January 7, 2009 Share Posted January 7, 2009 I got as far as displaying a text input box where a user can type in a name and a message (okay, I just stole it from another site, but it seems to work fine). I need the username, the comment they post, and the date it was posted to appear on the same page as the comment box. (The comment box is above the comment area, so when a user submits a comment, it will appear right below it, along with other comments users will submit, separated by a line or something. <div class="opt-spe"> <div class="rt">Comments</div> Add a new comment: </div> <form name="new_comment" method="post"> <input type="hidden" name="res" value="7029c8f06ef7e12a7d186cfafe2bbd1c" /> <div class="cmtadd"><table cellspacing="0" cellpadding="0" class="cmtadd"> <tr><td>Username: (required)</td><td><input type="text" name="user" maxlength="20" /></td></tr> <tr><td>Text: (required)</td><td><textarea name="text"></textarea></td></tr> <tr><td colspan="2" style="text-align: center;"><input type="submit" class="ibut" value="Submit comment" /> <input type="reset" class="ibut" value="Clear" /></td></tr> </div> </table> What do I have to do now? How can I make the submitted comments be saved in a separate file (it doesn't have to be, but I'm assuming that's how it works), and then displayed where I want it to? Link to comment https://forums.phpfreaks.com/topic/139821-how-do-i-make-user-comments-display/ Share on other sites More sharing options...
trq Posted January 7, 2009 Share Posted January 7, 2009 Theres a link in my signiture to a book (Hudzilla), in that book is a section on databases and php. That would be a good starting point. Link to comment https://forums.phpfreaks.com/topic/139821-how-do-i-make-user-comments-display/#findComment-731468 Share on other sites More sharing options...
worldcomingtoanend Posted January 7, 2009 Share Posted January 7, 2009 try these sites, they might be of help: http://www.phpjunkyard.com/ http://www.hits4me.com/php_forum.php Link to comment https://forums.phpfreaks.com/topic/139821-how-do-i-make-user-comments-display/#findComment-731506 Share on other sites More sharing options...
guitarscn Posted January 8, 2009 Author Share Posted January 8, 2009 Okay, I might have confused some people about what I needed so I'll try to make it clearer. I'm going to use an example from Slashdot: I post website news on my homepage: When a user clicks on 'Comments,' it leads to another page that looks just like the homepage, except it only displays that one news article that the person clicked on 'Comments' for: The format I want for the Comments section below the article is "Posted by [insert user here] on [insert date here]" followed by a break, the person's message, then a break, then a line to separate the comment from the next comment that will be displayed below that. The Comment input part between the article and the comments would look like this (just not as ugly): Which is the only thing I already have (the input boxes and Submit button I already have done, but the Submit button doesn't do anything). Link to comment https://forums.phpfreaks.com/topic/139821-how-do-i-make-user-comments-display/#findComment-732530 Share on other sites More sharing options...
guitarscn Posted January 8, 2009 Author Share Posted January 8, 2009 I checked this out: http://www.gentlesource.com/comment-script/ But I wasn't sure which snippets of code I needed to copy out to make the information from the form on my website page be put into a MySQL database I just created. Link to comment https://forums.phpfreaks.com/topic/139821-how-do-i-make-user-comments-display/#findComment-732931 Share on other sites More sharing options...
timmah1 Posted January 8, 2009 Share Posted January 8, 2009 You have a mysql database set up? What fields did you create in the database? All you need to do is insert into your database the $_POST variables of your form, THEN echo the information that was just put into your database, onto the page where you want them Link to comment https://forums.phpfreaks.com/topic/139821-how-do-i-make-user-comments-display/#findComment-732937 Share on other sites More sharing options...
guitarscn Posted January 9, 2009 Author Share Posted January 9, 2009 You have a mysql database set up? What fields did you create in the database? All you need to do is insert into your database the $_POST variables of your form, THEN echo the information that was just put into your database, onto the page where you want them The database is empty because I'm not really sure what to do with it. What are $_POST variables? My form is written in HTML Link to comment https://forums.phpfreaks.com/topic/139821-how-do-i-make-user-comments-display/#findComment-732962 Share on other sites More sharing options...
timmah1 Posted January 9, 2009 Share Posted January 9, 2009 Theres a link in my signiture to a book (Hudzilla), in that book is a section on databases and php. That would be a good starting point. Link to comment https://forums.phpfreaks.com/topic/139821-how-do-i-make-user-comments-display/#findComment-732966 Share on other sites More sharing options...
timmah1 Posted January 9, 2009 Share Posted January 9, 2009 Theres a link in my signiture to a book (Hudzilla), in that book is a section on databases and php. That would be a good starting point. http://www.hudzilla.org/phpwiki Link to comment https://forums.phpfreaks.com/topic/139821-how-do-i-make-user-comments-display/#findComment-732967 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.