I am a fairly new with PHP and I am in need of help in creating repeated string post
The code I have is listed below, what it currently does is when a user types into the comment field and then clicks the post button it post the string that was in the comment field to the bottom of the page
So for example when I type in another comment after the previous comment I still want the comment that was previously there but with the new comment above it sort of like facebook
<?php
$comment = "";
if ($_SERVER["REQUEST_METHOD"] == "POST")
{
$comment = input($_POST["comment"]);
}
function input($data)
{
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
?>
<h2>Comment Post </h2>
<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
<br><br>
Comment: <textarea name="comment" rows="7" cols="40"></textarea>
<br><br>
<input type="submit" name="submit" value="Post">
</form>
<?php
echo "<h2>Input:</h2>";
echo $comment;
?>
<?php
echo "<h1>Input:</h1>";
echo $comment;
?>
</body>
</html>
ORDER BY DESCto get the latest comment..ORDER BY DESCwithin the the mysql database I have but how would I use a mysql query on this?