I have this textbox in my code that everytime this page is loaded/refreshed, its content is filled with a query result. But since refreshing manually is not an option in my case, how can I do this automatically (I only want to refresh the textbox)? I've read about using AJAX, and I've been reading about it, but to be honest I don't quite get how to make it work, could someone explain me and dumb it down? Isn't there any easier way to refresh the textbox with the query content?
EDIT: Okay, I think I understood the basics of AJAX, the function is now refreshing the textbox every second, but there's a small problem. It messed up my table big time. I've modified the HTML code in hope someone can tell me what I did wrong. I'm thinking I shouldn't be including a div inside a table? Here's how my table looked like and how it looks like after this little update
<?php
include '../Login/db_login.php';
session_start();
$sql = "SELECT Contador FROM senhas2 WHERE ID=1";
$result = $conn->query($sql);
$row = $result->fetch_assoc();
$nome = $row['Contador']
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Página de administração - A</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
setInterval(function(){
$('#refreshtb').load('bt1admin.php');
}, 1000)
</script>
</head>
<body>
<form action="" id="atender" method="POST">
<table border="1">
<tr>
<td>Clientes em espera:</td>
<td><div id="refreshtb"><input id="refreshtb" type="text" value="<?php echo "$nome";?>"readonly></div></td>
</tr>
<tr>
<td>Selecionar posto de atendimento:</td>
<td><select name="posto"><option value="n1" selected>1</option><option value="n2">2</option><option value="n3">3</option><option value="n4">4</option><option value="n5">5</option><option value="n6">6</option></select>
</tr>
<tr>
<td colspan="2"><input type="submit" form="atender" name="atender" value="Atender Cliente Seguinte"></td>
</tr>
</table>
</form>
</body>
</html>