Sinisterly
how to create coment page in html or php ??? - Printable Version

+- Sinisterly (https://sinister.ly)
+-- Forum: Coding (https://sinister.ly/Forum-Coding)
+--- Forum: PHP (https://sinister.ly/Forum-PHP)
+--- Thread: how to create coment page in html or php ??? (/Thread-how-to-create-coment-page-in-html-or-php)



how to create coment page in html or php ??? - hoxy - 10-29-2012

example to my site http://seec0m.altervista.org/dls.htm


An example is given here on my website


but does not work


I can not post my comments


RE: how to create coment page in html or php ??? - H4R0015K - 10-29-2012

wait if I get some time I will make one comment system for you.


RE: how to create coment page in html or php ??? - bluedog.tar.gz - 10-29-2012

I suggest writing this in PHP since you could communicate with a database.


RE: how to create coment page in html or php ??? - H4R0015K - 10-29-2012

main page (comment.php).
Code:
<!DOCTYPE html>
<head>
    <title>comment</title>
    </head>
<body>

<form method='POST' action='addcomment.php'>
<label for='name'>Name :</label><br/>
<input type='text' id='name' name='name'>
<br/><label for='comment'>Comment :</label><br/>
<textarea id='comment' name='comment'>
</textarea><br/>
<input type='submit' value='add'>
</form><br/><br/>
<?php

$host='localhost';
$user='root';
$pass='harddisk';
$db='comment';
$table='comment';



$connection=mysql_connect($host,$user,$pass) or die('err1');
$select_db=mysql_select_db($db) or die('err2');
$get_comments=mysql_query("SELECT * FROM $table") or die('err3');
echo '<fieldset>';
while($getcomment=mysql_fetch_row($get_comments))
{
echo '<dd>Name : '.$getcomment['1'].'<dd>';
echo '<dd>Comment : '.$getcomment['2'].'<dd>';
echo '<br/>';
}
echo '</fieldset>';
mysql_close($connection);
?>
</body>
    </html>

page which will add comment in database (addcomment.php)
Code:
<?php
$host='localhost';
$user='root';
$pass='harddisk';
$db='comment';
$table='comment';
$name=$_POST['name'];
$comment=$_POST['comment'];

$connection=mysql_connect($host,$user,$pass) or die('err1');
$select_db=mysql_select_db($db) or die('err2');

mysql_query("INSERT INTO $table (name,comment) VALUES ('$name','$comment')") or die(mysql_error());

mysql_close($connection);

header('location:comment.php');
?>



RE: how to create coment page in html or php ??? - hoxy - 10-30-2012

(10-29-2012, 05:20 PM)h4r0015k Wrote: main page (comment.php).
Code:
<!DOCTYPE html>
<head>
    <title>comment</title>
    </head>
<body>

<form method='POST' action='addcomment.php'>
<label for='name'>Name :</label><br/>
<input type='text' id='name' name='name'>
<br/><label for='comment'>Comment :</label><br/>
<textarea id='comment' name='comment'>
</textarea><br/>
<input type='submit' value='add'>
</form><br/><br/>
<?php

$host='localhost';
$user='root';
$pass='harddisk';
$db='comment';
$table='comment';



$connection=mysql_connect($host,$user,$pass) or die('err1');
$select_db=mysql_select_db($db) or die('err2');
$get_comments=mysql_query("SELECT * FROM $table") or die('err3');
echo '<fieldset>';
while($getcomment=mysql_fetch_row($get_comments))
{
echo '<dd>Name : '.$getcomment['1'].'<dd>';
echo '<dd>Comment : '.$getcomment['2'].'<dd>';
echo '<br/>';
}
echo '</fieldset>';
mysql_close($connection);
?>
</body>
    </html>

page which will add comment in database (addcomment.php)
Code:
<?php
$host='localhost';
$user='root';
$pass='harddisk';
$db='comment';
$table='comment';
$name=$_POST['name'];
$comment=$_POST['comment'];

$connection=mysql_connect($host,$user,$pass) or die('err1');
$select_db=mysql_select_db($db) or die('err2');

mysql_query("INSERT INTO $table (name,comment) VALUES ('$name','$comment')") or die(mysql_error());

mysql_close($connection);

header('location:comment.php');
?>


thaks so much brooo


RE: how to create coment page in html or php ??? - Access2emma - 12-04-2012

what about to make like 10 comment appear on the page and some numbering at the bottom of that so that we can click on them to view more comments?


RE: how to create coment page in html or php ??? - LightX - 12-04-2012

The source my friend :p
Code:
<html>
<head>
<script language="javascript" type="text/javascript">
var maxAmount = 800;
function textCounter(textField, showCountField) {
    if (textField.value.length > maxAmount) {
        textField.value = textField.value.substring(0, maxAmount);
    } else {
        showCountField.value = maxAmount - textField.value.length;
    }
}
</script>
</head>
<body>
<form>
<textarea name="ta" rows="6" style="width:340px;" onKeyDown="textCounter(this.form.ta,this.form.countDisplay);" onKeyUp="textCounter(this.form.ta,this.form.countDisplay);"></textarea>
<br>
<input readonly type="text" name="countDisplay" size="3" maxlength="3" value="250"> Characters Remaining
</form>
</body>
</html>



RE: how to create coment page in html or php ??? - hoxy - 12-17-2012

download here : www.seec0m.altervista.org/commentscript.zip


RE: how to create coment page in html or php ??? - hoxy - 12-17-2012

download here : www.seec0m.altervista.org/commentscript.zip