Ver Mensaje Individual
  #3 (permalink)  
Antiguo 21/11/2012, 07:07
karma274
 
Fecha de Ingreso: septiembre-2012
Ubicación: Norte de Santander
Mensajes: 127
Antigüedad: 11 años, 7 meses
Puntos: 1
Respuesta: Problemas con array error illegal string offset...

Oops que pena habia hecho una modificacion. Ahora si aqui esta el script con el foreach...
Código PHP:
Ver original
  1. <?php
  2. include("../funciones/buscar.php");
  3.     if(isset($_POST['submit'])) {
  4.     $barrio = $_POST['barrio'];
  5.     }
  6. ?>
  7. <html>
  8. <head>
  9. <title></title>
  10. </head>
  11. <body>
  12. <form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">
  13. <label>CONSULTA:<input type="text" name="barrio" value="" /><br /></label>
  14. <input type="submit" name="submit" value="Comprobar Barrio" /><br /><br />
  15. <?php
  16. $res = buscar($barrio);
  17. if($res != null){
  18. foreach($res as $valor){
  19. ?>
  20. <label>BARRIO:&nbsp;&nbsp;<input type="text" name="barr" value="<?php echo $valor['barrio'];?>" /></label>&nbsp;&nbsp;&nbsp;
  21. <label>CIUDAD:&nbsp;&nbsp;<input type="text" name="ciudad" value="<?php echo $valor['ciudad'];?>" /></label>&nbsp;&nbsp;&nbsp;
  22. <label>COMUNA:&nbsp;&nbsp;<input type="text" name="comuna" value="<?php echo $valor['comuna'];?>" /></label><br />
  23. <?php
  24. }
  25. }else{
  26. echo '<span style="color:red">ERROR DE CONSULTA</span>';
  27. }
  28. ?>
  29. </form>
  30. </body>
  31. </html>