Fill combobox and auto complete inputs with php

0

I want to know how I can do the filling of a combobox with php, since I want that depending on what is selected in the combobox the inputs are automatically filled

I have a table called operators

id nombre   numero
1  carlos   1
2  gregorio 2

In my html I want that in a combobox the name is selected and depending on the name, that an input of text type is assigned the number.

    
asked by Cesar Gutierrez Davalos 24.07.2017 в 22:46
source

1 answer

0

I will leave from the point where I assume that you are listening to the change event for the names combo and since you did not attach code, I will create a brief and imaginary one:

$('#comboNombres').change(function(){
    $.ajax({
        url:"ruta.php?nombre="+$(this).val(),
        success: function(response){
            $('#inputNumeros').val(response)
        }
    });
});

The response should ideally consult and return the value that you will put in the input.

    
answered by 25.07.2017 в 23:53