I need to populate a form with Mysql database information in the onChange event of an input Select.
I know how to create a form of 0 by filling in the values property, but filling a form already created I'm not getting.
input type="button" class="botao_form1" onclick="ativarform()" value="EDITAR">
<input type="submit" class="botao_form1" value="CADASTRAR">
<script>
function ativarform(){
document.getElementById("sobrenome_cliente").disabled = false;
document.getElementById("idade_cliente").disabled = false;
document.getElementById("telefone_cliente").disabled = false;
document.getElementById("estado_cliente").disabled = false;
document.getElementById("endereco_cliente").disabled = false;
document.getElementById("cidade_cliente").disabled = false;
}
function actionform(){
/* AQUI O FORM DEVE RECEBER AS INFORMAÇÕES DO BANCO */
document.getElementById("sobrenome_cliente").disabled = true;
document.getElementById("idade_cliente").disabled = true;
document.getElementById("telefone_cliente").disabled = true;
document.getElementById("estado_cliente").disabled = true;
document.getElementById("endereco_cliente").disabled = true;
document.getElementById("cidade_cliente").disabled = true;
}
</script>
<?php
function popula(){
$conexao = conectar();
$nome = 'nome_ciente';
$sql = mysqli_query($conexao, "SELECT * FROM cliente WHERE nome='$nome'");
$row = mysqli_fetch_array($sql);
}
?>