<?php 
$url = $_GET['url'];
if ( $url !="")
{
$a = "http://";
$b = $a.$url;
header("Location:".$b);
 } 
else
{
alert("我爱你!")
}
?><html>
<head>
<title>表单</title>
</head>
<body>
<form method = 'get' action=''>
<input type = "text" name = 'url' value="" />
<input type = "submit" value="输入URL"/>
</form>
</body>
<html>

解决方案 »

  1.   


    <?php  
    $url = $_GET['url']; 
    if ( $url !="") 

       $a = "http://"; $b = $a.$url; header("Location:".$b);  
    } else{ 
       echo("我爱你!") 
    } ?>   
    <html> 
    <head> 
    <title>表单</title> 
    </head> 
    <body> 
    <form method = 'get' action=''> <input type = "text" name = 'url' value="" /> <input type = "submit" value="输入URL"/> 
    </form> 
    </body> 
    <html> 
      

  2.   

    <?php 
    $url = $_GET['url'];
    if ( $url !="")
    {
    $a = "http://";
    $b = $a.$url;
    header("Location:".$b);
     } 
    else
    {
    echo '<script>alert("我爱你!")</script>';
    }
    ?>
      

  3.   


    <?php 
    $url = $_GET['url'];
    if ( $url !="")
    {
    $a = "http://";
    $a .= $url;
    header("Location:".$a);
     } 
    else
    {
    echo '<script>alert("我爱你!")</script>';
    }
    ?>