【PHP】下拉列表实现的友情链接
程序员文章站
2024-01-25 16:56:16
...
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='$favsites[$x]'>$favsites[$x]"; $x++; endwhile; ?> </select> <input type="submit" value="go!"> </form> <? endif; ?>
上一篇: 面包屑导航详解