Hello,
I have just created a form and the form data is submitting using Ajax as I wanted the user to be on the same page after he submits the form as there are bootstrap accordian tabs data is submitting properly and retriving as well no problem but when the users click on submit data sends and save in the database where as sent data remains in the form like calues remain in the form when I refresh using F5 then values removes from the form and retrieved data update at that time. I want like on live chat we click on send on the same time the message posted on the message box
Get_data.php
<?php
session_start();
include("connection.php");
$receipt = $_POST["pid"];
?> <div class="tab-pane active" id="#<?php echo $receipt; ?>" style="height: 246px;"> <div class="demo"> <div class="messagebox"> <?php
$get_msgs = mysqli_query($connection, "SELECT users.fullname, messages.message, messages.time FROM messages, users WHERE (sender_id='$receipt' OR receipt_id='$receipt') and (sender_id={$_SESSION["uid"]} OR receipt_id={$_SESSION["uid"]}) AND (users.uid = messages.sender_id) ORDER BY msg_id ASC");
while($messages = mysqli_fetch_array($get_msgs)) {
?> <div class="message1"> <p class="username"><?php echo $messages["fullname"]; ?></p> <p class="time"><?php echo $messages["time"]; ?></p> <div class="clearfix"></div> <p class="messagebar"><?php echo $messages["message"]; ?></p> </div> <?php } ?> </div> <div class="reply"> <textarea class="messages" id="message" name="message">