script prueba.php que llama a la funcion buscar
Código PHP:
Ver original
<?php include("../funciones/buscar.php"); $barrio = $_POST['barrio']; } ?> <html> <head> <title></title> </head> <body> <form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <label>CONSULTA:<input type="text" name="barrio" value="" /><br /></label> <input type="submit" name="submit" value="Comprobar Barrio" /><br /><br /> <?php $res = buscar($barrio); if($res != null){ ?> <label>BARRIO: <input type="text" name="barr" value="<?php echo $res['barrio'];?>" /></label> <label>CIUDAD: <input type="text" name="ciudad" value="<?php echo $res['ciudad'];?>" /></label> <label>COMUNA: <input type="text" name="comuna" value="<?php echo $res['comuna'];?>" /></label><br /> <?php }else{ echo '<span style="color:red">ERROR DE CONSULTA</span>'; } ?> </form> </body> </html>
script buscar.php
Código PHP:
Ver original
<?php include("../conexiones/conexion.php"); function buscar($dato){ $barrio=$dato; return ($res); } } ?>