Quick Jump Menu Without a Go Button

This is a nice and clean quick tip to create a jump menu without a "go" button. Say for example you have a list of items in a database that need to have a details page based upon their "id". This will create a dropdown menu that is auto populated with the most up to date list.


// Connect to your MySQL database
require "path/to/your/database/connection/";

// Select the data
$select = mysql_query( "SELECT * FROM your_table_name ORDER BY column_name ASC") ord die("SELECT Error: ".mysql_error());

// This is a bit of javascript to grab the value of the <option> selected
<select onchange="window.open(this.options[this.selectedIndex].value,'_top')">

// Begin grabbing the rows from your database
while ($row = mysql_fetch_array($select)) {


<option value="details.php?id=<? echo $row['id']; ?>">
<? echo $row['column_name']; ?>




Post a comment
  1. Jeremiah Wall

    Thanks a ton for this. Really insightful.

Real Time Web Analytics ^