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

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

PHP中文网
Release: 2016-05-25 17:16:00
Original
1900 people have browsed it

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;
?>
Copy after login


source:php.cn
Statement of this Website
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
Latest Articles by Author
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template