Click here to Skip to main content
15,436,916 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i am developing a comment box with php and mysql,but my problem now is how to post the comment after user has enter their far i my php and mysql that save the comment in the database,but i want it to be visible on my webpage after it is save to database,i don't know the code for that,i need help.

What I have tried:

<pre><!DOCTYPE html>
commenting system

<form action = "cm.php" method = "POST">
<input type = "text" name = "fname" placeholder = "Name"><br><br>
<input type = "text" name = "website" placeholder = "website"><br><br>
<textarea type = "text" name = "scomment" rows = "6" col = "250" placeholder = "comment here....">
<button type = "submit">SUBMIT</button>


<pre lang="PHP"><pre lang="PHP"><pre lang="PHP"><pre lang="PHP"><pre lang="PHP">

include 'db.php';
$fname = $_POST['fname'];
$website = $_POST['website'];
$scomment = $_POST['scomment'];

$sql = "INSERT INTO client (fname, website, comment) VALUES ('$fname', '$website', '$scomment')";
$result = $con->query($sql);





$con = mysqli_connect("localhost", "root", "", "comment");

    die("connection error".mysqli_connect_error());


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900