Ver Mensaje Individual
  #6 (permalink)  
Antiguo 29/01/2013, 11:47
Avatar de informacionsys
informacionsys
 
Fecha de Ingreso: mayo-2011
Ubicación: Bogota D.C
Mensajes: 793
Antigüedad: 13 años
Puntos: 76
Respuesta: mostrar valor al seleccionar algo

hola

te doy un ejemplo de guia, pruebalo

Código HTML:
Ver original
  1. <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
  2. <script type="text/javascript">
  3. $(function()
  4. {
  5.     $("#productos").change(function()
  6.     {
  7.         $("#precio_prod").val($(this).val());
  8.     });
  9. })
  10. </script>
  11. <?php
  12. $productos = array(array("producto"=>"Camisas","precio"=>1000),
  13.                    array("producto"=>"Pantalones","precio"=>5000),
  14.                    array("producto"=>"Zapatos","precio"=>2000) 
  15.                   );
  16. ?>
  17. <select id="productos">
  18.     <option value="">Elegir</option>
  19. <?php
  20. foreach($productos as $valor)
  21. {
  22. ?>
  23.     <option value="<?php echo $valor["precio"]?>"><?php echo $valor["producto"]?></option> 
  24. <?php  
  25. }
  26. ?>
  27. <input type="text" id="precio_prod">