function printchat($PID) { echo "<chat class='scroll' id='chat'>"; $chat = getChatLog($PID); $chatN = count($chat); for ($x = $chatN - 1; $x > -1; $x--) { $message = $chat[$x]; echo "<p class='logP'>{$message}</p>"; } echo "</chat>"; echo "<chatsender>"; echo "<form action='action.php' method='post'><input type='text' name='mode' value='CHAT' hidden><input type='text' name='msg' class='chatbox'><input type='submit' value='Send'></form>"; echo "</chatsender>"; }
<meta http-equiv="refresh" content="15"> <?php include_once 'Core.php'; chatHeadprint(); $AID = $_SESSION["idnum"]; echo "<div class='chatholder' id='log'>"; $chat = getChatLog($AID); $chatN = count($chat); for ($x = $chatN - 1; $x > -1; $x--) { $message = $chat[$x]; echo "{$message}<br>"; } echo "</div>"; echo "<script>\nvar log = document.getElementById('log');\nlog.scrollTop = log.scrollHeight;\n</script>";