0
I need to populate a form with Mysql database information in the onChange event of a Select input.
I know how to create a form from 0 by filling 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);
}
?>
I couldn’t quite understand the scope of your problem. What exactly aren’t you getting? What have you tried? Had an error message?
– jlHertel