Now create a new page called ‘addcomment.php’
<?php $conn = mysql_connect('localhost', 'username', 'password'); mysql_select_db('yourdb'); $comdate = $_POST['comdate']; $articleid = $_POST['articleid']; $comsubject = htmlspecialchars(addslashes($_POST['comsubject'])); $comuser = htmlspecialchars(addslashes($_POST['comuser'])); $comtext = htmlspecialchars(addslashes($_POST['comtext'])); //write the query $sql = "insert into comments(comdate, articleid, comsubject, comuser, comtext)"; $sql .= " values ('" . $comdate . "', " . $articleid . ", '" . $comsubject . "', '" . $comuser . "', '" . $comtext . "');"; if (!@mysql_query($sql)) { echo ('We are unable to register your comment, sorry'); } else { echo ("Your comment was added successfully<br>"); echo ("<A HREF="article.php">Back to Articles</A>"); } mysql_close($conn); ?>
thanksss for tipp