Modify JS Autofill Function -- 2

Job ID: 40421726

Budget: $10 – $30 USD

I have a small JavaScript snippet that currently reads three form inputs—nombre1, apellido1 and apellido2—every second and posts them to ./getCount.php. I only want it to grab the first two: nombre1 and apellido1. Everything else should stay exactly as is: same 1-second interval and update ./getCount.php to match changes of only getting 2 inputs .

Please send back the revised code (or a pull request diff) so I can drop it straight into my page and see it working. No other changes are needed.

Get Count:

<?php
$servername = "localhost";
$username = "higeafar_root";
$password = "admin";
$dbname = "higeafar_higea";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}



$nombre = $_POST['nombre'];
$apellido = $_POST['apellido'];
$apellido2 = $_POST['apellido2'];
$sql = $conn->prepare('select medico from registros3 where nombre=? and apellido=? and apellido2=?');
$sql->bind_param("sss", $nombre, $apellido, $apellido2);
$sql->execute();
$sql->bind_result($total);
$sql->fetch();
$sql->close();
echo $total;