0
I am doing some tests with PHP + Oracle and I have a doubt. I made a combo, which takes data from Oracle, and that controls a textfield. Only now I need to update one more textfield, but there is no way. Someone can help me?
NOTE: In this text in the code the description is normal, but I need to add the "sector" in another.....
Javascript
function alimentarCampo() {
var codCampo = document.getElementById("codCampo");
document.getElementById("descrCampo").value = codCampo.options[codCampo.selectedIndex].value;
}
PHP
<?php
//Inicia seleção Combo e descreve no Text (Maquinas)
?>
<tr>
<td>Máquina:</td>
<td><select id="codCampo" name="codMaquinas" onchange="alimentarCampo();">
<option></option>
<?
include('config.php'); //conexao com o banco
//monta dados do combo das maquinas
$consulta = OCIParse($ora_conexao,"select CODIGO,NOME,SETOR from pcn_manut_maquina
order by CODIGO");
OCIDefineByName($consulta,"CODIGO",$v_num);
OCIDefineByName($consulta,"NOME",$v_nome);
OCIDefineByName($consulta,"SETOR",$v_setor);
OCIExecute($consulta);
while (OCIFetch($consulta)){
echo "<option value=\"".$v_nome."\">".$v_num."</option>"; //PRECISA DAS \ PARA PEGAR CAMPOS COM ESPAÇO
}
echo "</td>";
?>
</tr>
<tr>
<td></td>
<td><input type="text" id="descrCampo" name="descrMaquinas" readonly="true" size="60"></td>
</tr>
This smells very expensive to me of Ajax..... I think it would make your life easier
– MarceloBoni