this should be farefly straight forward.
you could choose to have the menu dynamically created or just create it your self and update it manually, i'll show you both version
Not Dynamically --------------------------
Page1.php (where the drop down menu is)
<form name="menu" method="GET" action="page2.php">
<select size="1" name="page">
<option selected>Menu</option> <!-- This will be displayed by default -->
<option>Home</option>
<option>Some Page</option>
<option>Some Page2</option>
<option>Some Page etc</option>
</select>
<input type="submit" value="Submit" name="submit">
</form>
Page2.php (the redirector)
<?
if (isset($_GET['page']) && $_GET['page'] != '') { // Check for variable
Switch ($_GET['page']) { // Use a switch statement as an if statement would be too long
Case "Home":
$url = "http://www.yoursite.com/index.php";
break;
Case "Some Page":
$url = "http://www.yoursite.com/sp.php";
Break;
Case "Some Page2":
$url = "http://www.yoursite.com/sp2.php";
Break;
Case "Some Page etc":
$url = "http://www.yoursite.com/sp3.php";
Break;
Default: // Set this incase anyone tries to input anything else
$url = "http://www.yoursite.com/sp3.php";
Break;
}
Header('Location: ' . $url); // Redirect to the page you just set
}
else { // $_GET['page'] doesnt exist
$url = "http://www.yoursite.com/index.php";
Header('Location: ' . $url);
}
?>
Dynamically -----------------------------
Make a table with 3 fields
id | name of page | url of page
with some information like
1 | home | index.php
2 | somepage | sp.php
Page1.php
<?
$sql = "SELECT * FROM `table_name`";
$qry = mysql_query($sql, $conn) or die(mysql_error()); // $conn is your connection to the mysql server
?>
<form name="menu" method="GET" action="page2.php">
<select size="1" name="page">
<option selected>Menu</option> <!-- This will be displayed by default -->
<?
while ($row = mysql_fetch_array($qry)) {
echo "<option>".$row['name_of_page']."</option>\n";
}
?>
</select>
<input type="submit" value="Submit" name="submit">
</form>
Page2.php
same principle
<?
if (isset($_GET['page']) && $_GET['page'] != '') { // Check for variable
$sql = "SELECT `url_of_page` FROM `table_name` WHERE `name_of_page` = '".$_GET['page']."'";
$qry = mysql_query($sql, $conn) or die(mysql_error());
if (mysql_num_rows($qry) == '1') {
$row = mysql_fetch_array($qry);
Header('Location: ' . $row['url_of_page']); // Redirect to the page you just set
}
else { // $_GET['page'] doesnt exist in database
$url = "http://www.yoursite.com/index.php";
Header('Location: ' . $url);
}
}
else { // $_GET['page'] doesnt exist
$url = "http://www.yoursite.com/index.php";
Header('Location: ' . $url);
}
?>
hope this helps