i've got a simple question here,
Ive got this form thats inside my chat html:
<form action="../addchat.php" method="POST" enctype="multipart/form-data">
<textarea id="textarea" style="border-radius:0px; border:none; background-color:rgb(243,243,243); min-height:100px;"name="comment" rows="4" cols="50"></textarea><br>
<input height="25px" width="20px" style="float:right;" type="image" src="../arrow.png" name="submit" value="Comment">
</form>
This form is for users to submit their chat messages. and after which, form post will direct the information to addchat.php, which contains the following code:
<?php
ob_start();
session_start();
include_once("config.php");
$reply=mysqli_real_escape_string($mysqli,$_POST['comment']);
$cid=mysqli_real_escape_string($mysqli,$_SESSION['cid']);
$uid=mysqli_real_escape_string($mysqli,$_SESSION['userid']);
$time=time();
$ip=$_SERVER['REMOTE_ADDR'];
$q= mysqli_query($mysqli,"INSERT INTO conversation_reply (user_id_fk,reply,ip,time,c_id_fk) VALUES ('$uid','$reply','$ip','$time','$cid')") or die(mysqli_error($mysqli));
?>
This script obviously adds the data into the tables and after which another script on the chat html page will display out the chat messages.
However, the current issue is that firstly, after user click submit, page will redirect to another blank page and show success message. Secondly, user need to refresh to see the new chat messages.
This chat application is a private chat (similar to Facebook), so not very sure how to do it? Would appreciate some help:)