Код:
<?php
include ("conn.php");
$q = "SELECT name,msg,time FROM chat";
$re = mysql_query($q);
while ($row = mysql_fetch_array($re)) {
$name = $row['name'];
$msg = $row['msg'];
$time = $row['time'];
}
echo "$name :";
echo "$msg -";
echo "$time";
?>
<html>
<head>
<title>Chat</title>
</head>
<body>
<hr>
<form action="" method=post>
<input type=text value=name>
<textarea name=msg rows=5 cols=60>напишете съобщението тук</textarea>
<input type=submit name=send value=Изпрати>
</form>
<?php
$name = htmlspecialchars('name');
$msg = htmlspecialchars('msg');
$time = date(F,j,Y,t);
$ip = a;
if (isset($_POST['submit'])) {
$ee = "INSERT INTO `a7558121_chat`.`chat` (`name` ,`msg` ,`time` ,`ip` ) VALUES ('$name', '$msg', '$time', '$ip')
$ress = mysql_query($ee); }
?>
</body>
</html>