Código PHP:
Ver original<?php
if(isset($_POST['btnURL']) and
isset($_POST['txtURL']){ if(!filter_var($_POST['txtURL'], FILTER_VALIDATE_URL
) === false){ }else{
$msj = "La url No es valida";
}
}
<form action="<?=$_SERVER['PHP_SELF']?>" method="post">
<?php if(isset($msj)): #Aqui imprimes mensaje de error si existe ?> <?=$msj ?>
<?php endif;?>
<label for="txtURL">Ingrese la URL</label>
<input type="text" name="txtURL" id="txtURL" />
<input type="submit" name="btnURL" />
</form>
?>