mostrar datos de select a un input


19 de Octubre del 2019

Hola esperando me puedan ayudar les doy las gracias de antemano, y es con lo que sigue 
Tengo una base de datos (gestión_db) de mysql y una tabla (claves) con 3 campos 
Clave      1.5 
Área       Dirección de Recursos Humanos 
Titular    Alfredo Jiménez 
Tengo un formulario (html) con un combo(select) y 2 input type=”text” 
Lo que pretendo hacer es que en un combo (select) despliegue la clave y cuando el usuario le de clic en cualquier clave despliegue su área y su titular correspondiente en los input’s  les menciono que soy aprendiz en PHP y la verdad no sé cómo se hace esto. Estuve viendo videos relacionados con la programación con php y me encontré uno que casi hace lo yo quiero fue necesario repetir el video para poder copiar el código pero cuando ejecuto el script no me da el resultado esperado le                                      Dejo abajo los 2 script esperando me puedan ayudar. 
GRACIAS 
ejem5.php 
<!DOCTYPE html> 
<html lang="es"> 
<head> 
   <title>Muestra Campos</title> 
   <meta charset="utf-8"> 
   <script type="text/javascript" src="http://code.jquery.com/jquery.min.js"></script> 
</head> 
<body> 
<form> 
<?php include("conecta.php"); ?> 
<select name="cvel" id="LstCve"> 
<? 
$qry = "Select * From claves"; 
$datos = mysqli_query($conectado,$qry); 
While($fila=mysqli_fetch_assoc($datos)){ ?> 
<option> <? echo $fila['clave']; ?> </option> 
<?}?> 
</select> 
<br /> 
<table> 
<tr> 
<td>Clave:</td> 
<td>  <input type="text" name="cve" id="idcve" /></td> 
</tr> 
<tr> 
<td>Area:</td>
<td><input type="text" name="are" id="idare" /></td> 
</tr> 
<tr> 
<td>Titular:</td> 
<td><input type="text" name="tit" id="idtit" /></td> 
</tr> 
</table> 
</form> 
<script type="text/javascript"> 
$(document).ready(function(){ 
$("#LstCve").focus(); 

$("#LstCve").keyup(function(e){ ; 
var url="ejem55.php"; 

$.getJSON(url,{ _num1 : $("#LstCve").val() }, function(claves){ 
$each(claves, function(i,claves){ 
$("#cve").val(claves.clave); 
$("#are").val(claves.area); 
$("#tit").val(claves.titular); 
}); 
}); 
}); 
}); 
</script> 
</body> 
</html> 

ejem55.php 
<? 
include("conecta.php") 
$cod = $_GET['_num1']; 

if (!empty($cod)){ 
comprobar($cod); 

function comprobar($cod){ 
$sql = "Select * From claves From clave = $cod"; 
$clte = array(); 
$lista = mysqli_query($conectado,$sql); 
$linea = mysqli_num_rows($lista); 
while ($linea = mysqli_num_rows($sql)){ 
$cve = $linea[0]; 
$are = $linea[1]; 
$tit = $linea[2]; 
$clte[] = array('clave'=>$cve, 'area'=>$are, 'titular'=>$tit); 


$json_string = json_decode($clte); 
echo $json_string; 
?>