Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Trending News
How to create website comment section using Php scripts and MySQL database?
Hi, I'm a newbie to Php and MySQL.
I need a very simple comment section for our website:
All it needs to do is ask for the commenter's email and the comment itself and there would basically be a submit button that does not allow you to continue unless both the commenter's email address box and comment box have been filled up. The comments would have to be saved in a MySOL databse and the comments should appear below the comment box on the webpage.
If possible, can somebody give me the code for that as well? Thanks.
3 Answers
- EnnazzusiLv 58 years agoFavorite Answer
CoffeeCup Web Form Builder is perfect for generating fast and professional online data forms. They offer a free version too.
Source(s): http://www.abcomputered.com/blog/2011/02/27/about-... http://www.coffeecup.com/web-form-builder/ - J0nny3Lv 68 years ago
You would need to know about doing mysql queries.. like INSERT (for inserting comment data) or UPDATE too (depending if you want comments to be edited for example)
You should know about PHP's $_POST and how it works with a form so the form data (i.e the comment data) can be posted and processed.
To not allow a form to be submitted unless it was were filled in you would need to do some php if statements .. e.g..
if($email && $comment == '') {
echo 'Please fill in both fields
}
else {
/// do mysql query here etc
}
You could do form validation with javascript to for better user experience... but highly recommended to validate on server side too incase javascript not enabled on users browser.