Código HTML:
<select id="caja" onchange="FijarPrecio(this.id);"> <option value="10">producto 1</option> <option value="20">producto 2</option> <option value="30">producto 3</option> </select> <input type="text" name="p" id="p" /> <script type="text/javascript"> function FijarPrecio(id){ var combo = document.getElementById(id); var input1 = document.getElementById('p'); input1.value = combo.value; } </script>
hice esto
Código PHP:
<script type="text/javascript">
function pasar(i) {
var combo = document.getElementById('caja1').value;
var input1 = document.getElementById('p' + i).value;
input1.value = combo.value;
}
</script>
<select name="caja1" id="caja1" onchange="pasar(i);" >
<input type="text" name="p[]" id="p<? echo $i;?>" value="" size="3" class="inputcentradop" />