How to display the nickname of the sender of the message in the chat?

I have a chat on my site, but messages without the sender’s nickname. Please help.

Here is the chat itself :

<iframe name='chatWindow' id='chatWindow' src ="iframe.php" width="1265" height="400">
<form action="iframe.php" method="post" name="form" target='chatWindow' >
<p>:<input name="message" type="text" size="75" maxleght="255">
<input name="submit" type="submit" value="OK">

A is an iframe:

if (isset($_POST['message']))
$message = $_POST ['message'];
$db = mysql_connect("","bakugan609","s026y8pjtl");
$result = mysql_query("INSERT INTO messages (message) VALUES ('$message')");
$result = mysql_query("SELECT * FROM messages");
while( $row = mysql_fetch_array( $result ) ){
echo "<br>";
echo "{$row['message']}

Answer 1, authority 100%

You’ll have to save your nickname first. To do this, in the table where the message is boasted, also make a place for the nickname and then write it:

$result = mysql_query("INSERT INTO messages (message,nick) VALUES ('$message','$nick')");
echo "{$row['nick']}: {$row['message']}";