<input name="otkogo" type="text" />
<input name="komu" type="text" />
<div class="table" style="display:none">
<div class="user">
<span class="id">1</span>
<span class="name">меня</span>
</div>
<div class="user">
<span class="id">2</span>
<span class="name">забанили</span>
</div>
<div class="user">
<span class="id">3</span>
<span class="name">в</span>
</div>
<div class="user">
<span class="id">4</span>
<span class="name">гугле</span>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script>
$('input').focusin(function(){
var name = $(this).attr('name');
$('.table').attr('kuda',name).fadeIn();
});
$('.table').on('click','.user',function(){
var kuda = $('.table').attr('kuda');
var value = $(this).find('.id').html()+' - '+$(this).find('.name').html();
$('*[name="'+kuda+'"]').val(value);
$('.table').fadeOut();
});
</script>