Ver Mensaje Individual
  #2 (permalink)  
Antiguo 27/12/2015, 20:07
rjulio21
 
Fecha de Ingreso: marzo-2011
Ubicación: Caracas
Mensajes: 389
Antigüedad: 13 años, 2 meses
Puntos: 16
Respuesta: Un pequeño codigo....

Código PHP:
Ver original
  1. <?php
  2. if(isset($_POST['btnURL']) and isset($_POST['txtURL']){
  3.      if(!filter_var($_POST['txtURL'], FILTER_VALIDATE_URL) === false){
  4.                header('location:'.$_POST['txtURL']).'');exit;
  5.       }else{
  6.              $msj = "La url No es valida";
  7.       }
  8.    
  9.  
  10. }
  11.  
  12. <form action="<?=$_SERVER['PHP_SELF']?>" method="post">
  13.         <?php if(isset($msj)):  #Aqui imprimes mensaje de error si existe ?>
  14.               <?=$msj       ?>
  15.          <?php endif;?>
  16.         <label for="txtURL">Ingrese la URL</label>
  17.     <input type="text" name="txtURL" id="txtURL" />
  18.     <input type="submit" name="btnURL" />
  19. </form>
  20.  
  21.  
  22.  
  23.  
  24.  
  25. ?>
__________________
Lo imposible es lo posible visto por los ojos de un incapaz.
Si te sirve la respuesta. dale + al karma.
Saludos