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>