I was trying to build a simple comment section in my website. I created two fields (or boxes) with Name and Comment. Now if I fill up the Name and Comment fields and hit Submit it shows "Webpage isn't found" error (See the attachment). Besides, nothing is updating into my database.
[NOTE: After all my local server is properly installed and everything else works fine. I worked with my phpMyAdmin before and that time it was able to derive data from the database. WAMP server is also running. I am following this tutorial and code.]
main.php:
<!--php code for comment section starts-->
<?php
require ('connect.inc.php');
$name=$_POST['name'];
$comment=$_POST['comment'];
$submit=$_POST['submit'];
if($submit){
if($name&&$comment){
$insert=mysql_query("INSERT INTO comment(name, comment) VALUES ('$name','$comment')");
}else{
echo "Please fill all the fields";
}
}
?>
<!--php code for comment section ends-->
<!--building a comment section starts-->
<form action="main.php method="POST">
<table>
<tr><td>Name: </td><td><input type="text" name="name"/> </td> </tr>
<tr><td colspan="2">Comment: </td></tr>
<tr><td colspan="2"><textarea name="comment"></textarea></td></tr>
<tr><td colspan="2"><input type="submit" name="submit" value="Comment"/> </td></tr>
</table>
</form>
<!--building a comment section ends-->
connect.inc.php:
<?php
mysql_connect("localhost", "root","");
mysql_select_db("comment_section");
?>