Home  >  Article  >  php教程  >  【PHP】下拉列表实现的友情链接

【PHP】下拉列表实现的友情链接

PHP中文网
PHP中文网Original
2016-05-25 17:16:001832browse

PHP代码

<?
if ($site != "") :
    header("Location: http://$site");
    exit;
else :
?>
 
<html>
<head>
<title></title>
</head>
<body>
<?
$favsites = array ("www.oschina.net","www.google.com","www.csdn.net","www.php.com");
 
?>
<form action = "index.php" method="post">
<select name="site">
<option value = "">Choose a site:
<?
$x = 0;
 
while ( $x < sizeof ($favsites) ) :
          print "<option value=&#39;$favsites[$x]&#39;>$favsites[$x]";
          $x++;
endwhile;
?>
</select>
<input type="submit" value="go!">
</form>
<?
endif;
?>


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn