每次提交表单时,从文本字段连接并显示用户输入

I'm trying to create a messenger style application. First off I'm just trying to understand how to concatenate user conversations into a variable each time a form is submitted and then display the result. However, my code overwrites the previous message so only displays the most recent. I've created a very basic example below for demonstration leaving out form validation for clarity. I would really appreciate some help wit this.

Thanks in advance for taking the time to read or respond to this post. It's always appreciated :)

<?php 

$message .= $_REQUEST["message"];

?>

<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Messanger</title>
</head>

<body>

<p id="message" >
<?php echo "Message: " . $message; ?>
</p>

<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">

    <input id="message" type="text" name="message">
    <br />
    <input type="submit" name="submit" value="Submit">

</form>

</body>
</html>

You are getting only recent value what about old values.

You need to store the values in session and whenever we get more values, append it.

Corrected code

<?php 
session_start();
$message = isset($_POST['message']) ? $_POST['message'] : '';
if (! empty($message)) {
 if (! isset($_SESSION['message'])) {
  $_SESSION['message'] = $message;
 }
 else {
  $_SESSION['message'] .= "<br/>". $message;
 }
}
echo $_SESSION["message"];
?>