Version: 0.1

Type: Function

Category: Other

License: GNU General Public License

Description: This easy to edit function makes a drop down menu. When you select an item and click go, you will be taken to that url.



<?php

function dropmenu ()
{
//#######################################//
//ONLY EDIT URL'S AND NAMES BELOW HERE
$menunames=array("Omnix-Inc.com", "Myspace.com", "NewGrounds", "Yahoo IM", "AIM");
$menuurls=array("http://omnix-inc.com", "http://myspace.com", "http://newgrounds.com", "http://messenger.yahoo.com", "http://aim.com");
//ONLY EDIT URL'S AND NAMES ABOVE HERE
//#######################################//
$namenum=count($menunames);
$urlnum=count($menuurls);
?>
<script type="text/javascript">
<!--
function go(){
location=
document.mycombo.dropgo.
options[document.mycombo.dropgo.selectedIndex].value
}
//-->
</script>
<?php
if ($namenum == $urlnum)
{
$i=0;
?>
<form name="mycombo">
<select name="dropgo" size="1">
<?php
while ($i < $namenum)
{
echo "<option value=\"$menuurls[$i]\">$menunames[$i]</option>";
$i++;
}
?>
</select>
<input type="button" name="test" value="Go!" onClick="go()">
</form>
<?php
}
else
{
echo "Menu Names and Menu Url's Do Not Match";
}
}
//############################
//CALL IT WITH THIS FUNCTION
//just include this file and its done.
dropmenu();
//############################
?>