web learning

HTML

CSS

PHP

JAVA SCRIPT

AJAX

EBOOKS

PROJECT

FORUM


filetype: comments.html


<html>
<head>
<title>comment box</title>
</head>

<body>
<form action="sabincomment.php" method="post">
name:<input type="text" id="name" name="name"><br>
comment:<textarea id="comment"name="comment" rows=4 cols=60>your text here</textarea>
<input type="submit" id="submit" name="submit" value="comment">
</form>
http://webstufflearning.blogspot.com/
</body>
</html>



filetype:sabincomment.php


<?
$name=$_POST['name'];
$comment=$_POST['comment'];
$con=mysql_connect("localhost","root","");
mysql_select_db("share",$con);
$sql="INSERT INTO comment(name , comment) VALUES ('".$name."','".$comment."')";
$result=mysql_query($sql);
mysql_close();
if($result){
header('location:http://localhost/comments/display.php');
}

?>

http://webstufflearning.blogspot.com/






filetype:display.php



<html>
<head>
<title>comment box</title>
</head>
<body>
<?
$con=mysql_connect("localhost","root","");
mysql_select_db("share",$con);
$sql="SELECT * from comment";
$result=mysql_query($sql);
mysql_close();
while($row=mysql_fetch_array($result)){
$name=$row['name'];
$comment=$row['comment'];
echo "$name:<br>$comment:";}
?>
http://webstufflearning.blogspot.com/
</body>
</html>





Categories:

Leave a Reply